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

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

Related

Rest API testing with JGiven

I am quite new to JGiven and currently I have a set of REST API tests automated using Rest Assured and TestNG framework. I am also exploring JGiven as a framework to run the API tests for the advantages it gives with the human readable given when thens and the reports that it generates too. Rest Assured as a library lets us inject the URLs and actually make the REST calls. I want to understand if we have such capabilities within JGiven to actually make the REST calls. If so, I'd like to see an example and understand how I can do that. If not, can someone kindly advice and suggest the best way to achieve it with JGiven. I've been trying to search for this information but have struggled to do so thus far.
Thanks in advance.
JGiven is useful for creating test scenarios that are understandable by domain experts. It is a general tool that can be used for any kind of testing, including testing REST APIs. JGiven adds an understandable layer on top of your underlying test infrastructure. However, you will typically need tools in addition to JGiven to implement the underlying layer. So for testing REST APIs you will use a tool like Rest Assured in combination with JGiven. With JGiven you describe your scenario in the domain language, with Rest Assured you will execute the REST calls.

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.

How do you document the xml structure of a REST API Call?

Like SOAP which as a WSDL which allows you generate code that will help create request, is there any mechanism in REST which allows you to document the payload or response of a REST API call?
Most services that provide REST APIs, seem to provide samples to explain the structure.
What is the best practice for REST APIs.
If you're returning xml, you can simply provide an xsd. There is also wadl, which some frameworks will generate automatically.
I find the best practice is providing samples (or links to samples) to explain the structure. Developers working against your API then need no extra tools or workflows to know how to interact with each part of your service.

How to consume ASPX webservices in iOS?

Could anybody clarify the process of consuming aspx webservices in iOS? I have already tried JSON framework but now, need to create an app that consumes .net webservices in XML format. I need both to post some data to, and get data from the server. I already read about existing XML parsers for iOS that I found (here)
The question is do I need to do additional setup, like wrapping my query strings in SOAP or smth, in order to communicate with webserver? Would it be sufficient to use only one of mentioned libraries in the link or do I need additional stuff?
UPDATE: I found one tutorial on web (here) that demonstrates how to consume web services using Json-framework. Also, I found another one that demonstrates it using NSXMLParser (here). I'm not not very familiar with WSDL and SOAP, so any detailed explanation on how to implement would be desirable :). In both of these examples you just have to construct a request string in xml format and execute it, and that's it. Both examples actually bypasses the heavyness of SOAP and WSDL, so I was wondering do I have to know and do more that just construct a request string, execute it and get response?
While wsdl2objc is out there (as noted by #Girish Kolari), the truth is that there's no easy answer. I've never successfully gotten wsdl2objc working well for something that I couldn't have done more easily by hand. You will need to learn SOAP and WSDL. That's just a fact of life if you can't get access to a REST interface. In my experience, your best bet for simple SOAP access is to do it by hand, and your best bet for somewhat complicated SOAP access is gSOAP. Your best bet for very complicated access is to redesign something so it's not so complicated, ideally in REST. SOAP is a giant pain that some languages (C#) shield you from. ObjC does not shield you from it, so it continues to be a giant pain.
Yes, SOAP leaves a bad taste in my mouth.

RESTful Services - WSDL Equivalent

I have been reading about REST and SOAP, and understand why implementing REST can be beneficial over using a SOAP protocol. However, I still don't understand why there isn't the "WSDL" equivalent in the REST world. I have seen posts saying there is "no need" for the WSDL or that it would be redundant In the REST world, but I don't understand why. Isn't it always useful to programmatically bind to a definition and create proxy classes instead of manually coding? I don't mean to get into a philosophical debate, just looking for the reason there is no WSDL in REST, or why it is not needed. Thanks.
The Web Application Description Language (WADL) is basically the equivalent to WSDL for RESTful services but there's been an ongoing controversy whether something like this is needed at all.
Joe Gregorio has written a nice article about that topic which is worth a read.
WSDL describes service endpoints. REST clients should not be coupled to server endpoints (i.e. should not be aware of in URLs in advance). REST clients are coupled on the media-types that are transfered between the client and server.
It may make sense to auto generate classes on the client to wrap around the returned media-types. However, as soon as you start to create proxy classes around the service interactions you start to obscure the HTTP interactions and risk degenerating back towards a RPC model.
RSDL aims to turn rest like a hypermedia, in other words, it has more information than a service descriptor like WSDL or WADL. For example, it has the information about navigation, like hypertext and hyperlinks.
For example, given a current resource, you have a set os links to another resources related.
However, i didn't find Rest Clients that supports this format or Rest Server Solutions with a feature to auto generate it.
I think there is a long way for a conclusion about it. See the HTML long story and W3C vs Browsers lol.
For more details about Rest like Hypermedia look it: http://en.wikipedia.org/wiki/HATEOAS
Note : Roy Fielding has been criticizing these tendencies in Rest Apis without the hypermidia approach: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
My Conclusion : Now a Days, WADL is more common that Rest and Integration Frameworks like Camel CXF already supports WADL ( generate and consume ), because it is similar to WSDL, therefore most easy to understand in this migration process ( SOAP to REST ).
Let's see the next chapters ;)
Isn't it always useful to programmatically bind to a definition and
create proxy classes instead of manually coding?
Agree wholeheartedly, this is why I use Swagger.io
Swagger is a powerful open source framework backed by a large
ecosystem of tools that helps you design, build, document, and consume
your RESTful APIs.
So basically I use Swagger to describe my models, endpoints, etc, and then I use other tools like swagger-codegen to generate the proxy classes instead of manually coding it.
See also: RAML
There is an RSDL (restful service description language) which is equivalent to WSDL. The URL below describes its practice http://en.wikipedia.org/wiki/HATEOAS and http://en.wikipedia.org/wiki/RSDL.
The problem is that we have lots of tool to generate code from wsdl to java, or reverse.
But I didn't find any tool to generate code from RSDL.
WSDL is extensible to allow description of endpoints and their messages regardless of what message formats or network protocols are used to communicate
However, REST uses the network protocol by using HTTP verbs and the URI to represent an objects state.
WSDLs tell you at this place, if you send this message, you'll perform this action and get this format back as a result.
In REST, if I wanted to create a new profile I would use the verb POST with a JSON body or http server variables describing my profile to the URL /profile
POST should return a server-side generated ID, using the status code 201 CREATED and the header Location: *new_profile_id* (for example 12345)
I can then perform updates changing the state of /profile/12345 using the HTTP verb POST, say to change my email addresss or phone number. Obviously changing the state of the remote object.
GET would return the current status of the /profile/12345
PUT is usually used for client-side generated ID
DELETE, obvious
HEAD, gets the status without returning the body.
With REST it should be self-documenting through a well designed API and thus easier to use.
This is a great article on REST. It really help me understand it too.
WSDL 2.0 specification has added support for REST web services too. Best of both worlds scenario. Problem is WSDL 2.0 is not widely supported by most tools out there yet. WSDL 2.0 is W3C recommended, WSDL1.1 is not W3C recommended but widely supported by tools and developers.
Ref:
http://www.ibm.com/developerworks/library/ws-restwsdl/
The Web Application Description Language (WADL) is an XML vocabulary used to describe RESTful web services.
As with WSDL, a generic client can load a WADL file and be immediately equipped to access the full functionality of the corresponding web service.
Since RESTful services have simpler interfaces, WADL is not nearly as necessary to these services as WSDL is to RPC-style SOAP services.