Generating soapUI Rest Service Mock - rest

I created a REST service project in version 4.6.0, and added a mock. I'm not able to add an operation for the mock. I get..
No unique operations to mock in project!
I am able to directly modify the onRequest script and set the response status code for GET messages. However, when I switch to POST, which is what I really need, I get a SOAP fault string in the response:
org.apache.xmlbeans.XmlException: Missing/Invalid SOAP Envelope,
expecting [{http://schemas.xmlsoap.org/soap/envelope/}Envelope]
How can I bypass soapUI's SOAP processing of the message? I'm trying to post a plain old XML message, not SOAP.
posting: <test></test>

As Temil Sanchez writes for a question asked on the soapUI forum:
Rest Mocking was not that fully supported in 4.6.3, the only
workaround for Rest Mocking in 4.6.3 is located here :
http://www.soapui.org/Getting-Started/mock-services.html
rest mocking becomes much easier to do in our SoapUI 5.0 Release which
should be available on April 1st. In the meantime we have a Beta that
you can try here:
http://forum.soapui.org/viewtopic.php?f=2&t=23529

Related

Is there any functionality similar to "Schema Compliance" and "SOAP Response" as in Ready API in Karate? [duplicate]

Is it possible to use WSDL in rest assured, I'm looking for open source API automation testing tool. My services are in WSDL, I can use SOAPUI which will extract wsdl into separate end points. but Is there any way can we extract end in WSDL manually or else how I can use this with Karate or Rest Assured.
As the author of Karate, let me give you my point of view.
You don't need to worry about WSDL. All you need is a sample SOAP envelope as XML (plain-text) and you will be easily able to derive all your tests, complex scenarios and edge cases with that. This is what many teams are doing today, and you can refer this detailed set of examples to get a sense of the possibilities: xml.feature
Even if you have some complexities like encryption and signed-headers etc, you can easily plug them into your tests using Java-interop, look at this example in the documentation: https://github.com/intuit/karate#http-basic-authentication-example

SOAP Request: How to make multiple request messages in sequence

I have a SOAP endpoint and will be having more than 1000 request messages which have different values for the request parameters but same operation of SOAP Message. I want to execute them in a sequence if the previous request that got triggered was 200 OK?
Is there any way to do this without JAVA program? Is there any client that will help me?
I assume you already have some sort of loop in your test case that reads your variable properties from a file or perhaps Excel and feeds them into your SOAP request. Ready API/soapUI Pro gives you this functionality, but for open source soapUI you'll have to write your own Groovy test steps.
Then, you can use a soapUI Compliance, Status and Standards assertion to check you've received a valid or invalid HTTP status code and react accordingly.
Is there any way to do this without JAVA program? Is there any client
that will help me?
After re-reading the question, it seems to me you're not yet using SoapUI, though it has been tagged as a SoapUI question. It happens quite a lot on here where people are askign general SOAP questions, but tag SoapUI. BTW, Craig's answer should be accepted if you are using SoapUI.
In terms of options, you have lots....
Code. You can use Python, C#, Java, Javascript, etc. etc. to create a program that will call your endpoint. Any programming language will have the libraries to call web services. So, if you do know a language, you could use that.
SoapUI. There is a free version, which will allow you to call web services. In your question, you want to call the same service over and over with different parameters. In testing speak, this is a data-driven test. These can be achieved in the free SoapUI, but it is a fiddle. However, the full-licensed version offers data-driven tests out of the box. I use these all the time. Very easy to set-up. If you use SoapUI, then Craig's answer about using Assertions would stop the test if you got a status code other than a 200.
Postman. this is another free tool, which I have used a little. I haven't tried data-driven tests, but I'm sure the docs will tell you if they're supported. If you try Postman, then you ought to look at Danny Dainton's excellent tutorial on GitHub
JMeter. Another free tool. This is primarily used for performance and load testing, but would still meet your needs.

Workday Studio - request with HTTP out to vendor API receiving error with: No bean named 'http-token-auth' is defined

I have a Workday studio integration to send a GET request to a vendor's API using an HTTP component, but I'm receiving the error below. The vendor doesn't have a username/password to connect. I have to connect using a token. Does anyone know how to make this work from Studio to GET data?
Reason: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'http-token-auth' is defined
I have sent the request in many different ways: hard coding the URL with the token, setting headers with the token. Below are my different attempts.
I’m not sure what Http authorization this is supposed to use. There is no username/password, just a token and a URL to post using CURL. Below is what studio looks like with the HTTP properties.
Below is what is set on the Header.
Also, I'm able to GET data using SoapUI. Below is a snip of the request in SoapUI.
Below is the JSON raw request in SoapUI that is successful in getting data from the API.
Any help is much appreciated!!
Thank you, -Remo
To preface; I'm not familiar with Workday Studio, and there don't seem to be any public docs, so there may be some nuance here that this answer misses.
Summary
Workday, your code, or possibly some library being used is referencing a bean (see Spring docs: Core Technologies) that does not exist or can not be found.
If you're not writing any Java code whatsoever here, it's almost certainly either a configuration issue or bug in Workday Studio. Below are some observations based on the information you've provided. But first, a wild guess.
Wild Guess
It seems likely that Workday is handling this a little differently than cURL or SoapUI. cURL and SoapUI are doing something like the following:
Send GET request to URL with params, and include API key in header
Server sends desired response
However, it sounds like Workday is doing something more like:
Send GET request assuming a pre-auth scenario, using challenge-type: 'token'
Server responds with the correct auth-type that its framework (presumably Rails) uses for tokens; 'http-token-auth'
Workday (wrongly) assumes that the server is using the Spring framework, and tries to load the correct auth-type bean based on that response
Spring framework barfs because there's no such bean
I imagine there's some way to get Workday to play nicely with a standard REST API, and just supply the API key to the vendor's server as it expects, rather than trying to do a challenge/response.
If this isn't it, there are some more weedy possibilities below.
Odd Bean Name
The bean name specified in the error is http-token-auth, which is in kebab-case. The convention for naming beans is (lower-) camelCase, so wherever that's specified may have just used the wrong casing.
This could be in the Workday Studio configuration, the XML config file, or some custom code you've written, if any.
Configuration
If the bean name is correct, then there's likely some other configuration issue. Spring can implicitly detect candidate components by scanning the classpath (see Spring docs: Classpath scanning and managed components) or loading it from the project XML. The issue could be:
The build path is wrong (see this answer by esaj if you're unfamiliar)
The classpath is wrong, so Spring just doesn't see it. This seems like a Workday-specific config in this case.
The bean is in the project XML, but nested. In that case, it'd only be accessible to the enclosing bean. One solution to this is to activate the corresponding profile.
A packaging issue; if the bean isn't being included in the resulting deployed jar, then there will be issues. This solution by dawrutowicz should apply in a number of cases.
Project configuration; all the settings in your screenshots look exactly correct and should work fine, so there might be something hidden in your project settings
Bug in Workday Studio
This seems somewhat less likely, but is always a possibility. If you haven't written any Java code whatsoever, then there's something either in the Workday code that's serving up this unexpected 'http-token-auth' or inappropriately accepting it from somewhere else and trying to load up a bean using it.
Final Thoughts
Since you're trying to work with a vendor's API, I'd strongly recommend you try to collaborate with one of the engineers there. Guaranteed, they have at least one engineer who has dealt with complicated integration issues before. They'll have more details about their API, and might be able to give you more direct input on any configuration/code you'd be able to share.
I had an identical error message reported when sending a Rest POST request to a 3rd party web service from Workday Studio using Bearer authentication.
The resolution was to set the header output type to "message" instead of a "rootpart". It is not a bug in Workday Studio.
Workday Studio set header output type setting
Regards,
Shiraz

Is Rest-Assured api supporting SOAP

We are trying to perform tests using Rest Assured Api but we aren't getting success with the response. We sent a request but the response is a faultcode (xml). The same request was made successfully using Soapui.
So, we searched a lot, people say that rest assured supports SOAP and others says that doesn't support.
Anyone knows what is the truth? Supports or not?
While it does not specifically support SOAP protocol, nothing stops you from using RestAssured for SOAP Servers testing - because it is just sending and receiving XML over HTTP and RestAssured does this perfectly well.
To be honest, the fact that RestAssured is not specifically designed to support SOAP makes it even more valuable for error testing, which would be really difficult with SOAP-centered clients.
Here's more details how one can verify XML content: https://github.com/rest-assured/rest-assured/wiki/Usage#example-2---xml
Rest-Assured framework only supports testing REST services.
You can read the introductory post by Johan (Rest-Assured committer) in the below link:
https://www.jayway.com/2013/11/29/rest-assured-2-0-testing-your-rest-services-is-easier-than-ever/
Also in the source code of REST-Assured in Github, it is never mentioned about supporting SOAP services, or has code that supports it.
https://github.com/rest-assured/rest-assured
If you want a single framework supporting both REST and SOAP services try the following options.
http://www.citrusframework.org/
https://www.soapui.org/developers-corner/integrating-with-soapui.html
Currently, We are leveraging a REST API framework tool to automate large soap msgs for api testing, fundamentally rest and soap are same.
The only difference is SOAP msg payload is in xml and response is in xml, will have single header and single type of https request -POST.
you just have to write supporting utils for constructing payload and then processing response.

In SOAPUI service mocking, is there a way to generate representative values for response fields?

I am trying to develop a SOAP client for a service to which I don't yet have access. I have therefore loaded the wsdl into soapui and am using the soapui service mocking functionality.
When I generate a mock response, the values are always set to '?'. Is there any way to ask soapui to generate representative test values given the type of each field? (The response in question has about 500 fields, so this would be really nice..). Alternatively, is there another tool I could use to generate such a response from a wsdl?
Many thanks!
Ah - answered my own question. Go to preferences -> WSDL and check the box that say sample data for requests. Even though it says for requests, it also generates sample data for responses :-)