I am doing integration testing of my system with a 3rd party web service. They have provided the WSDL and the XML soap response packets but the web service hasn't been built yet. I am using WCF to call the web service.
Any suggestions on how to write the end-point to send back the response contained in the XML file?
I know I can generate the service side from the WSDL but I'd like to verify the integration using the supplied XML packets.
I'm sure there's a more technical way, maybe using an interceptor to replace the soap response form your mock service, but a quick hack might be to just create the Mock service with SvcUtil, and grab your own SOAP response off the wire with fiddler or wireshark and compare the responses.
I think SOAP UI serves your purpose. Using SOAP UI you can have a dynamic behavior to the service you want to mock. For example you might want to:
Read some data in a request and use its value to select which response to return
You can also virtualize the services multiple SOAP request and response very well using ITKO/CA LISA.
LISA will record live service requests and responses, and create a virtual test bed to remove the team's dependency on live, connected systems or fully replicated test beds
You can also mock using concrete WSDL of target system using LISA
Related
This is a difficult one so hoping someone has been here before with this.
Long story short - we have several hundred web services in projects that use Microsoft's "Add Service Reference" to generate methods from the wsdl.
We now need to push these thru another service first and relay on the call to the original server and do the same with the response.
We have a service that takes soap requests (XML) and does this already so want to reuse this if possible.
How do we get at the SOAP request data either via intercepting the web service call (redirect to stream or file etc.) or see what it would have generated as SOAP XML.
We have no way of using current software to redirect these calls so need a bespoke solution as we need also to track everything going thru the re-director.
The existing rerouting service takes a SOAP XML and passes to another URL and works well for a different project - so we just need the SOAP XML produced by the web service call and we can reuse the service.
//Example call to a simple wsdl generated interface...
Calc.CalculatorSoapClient clc = new Calc.CalculatorSoapClient();
clc.Open();
int x = clc.Add(1, 2); // need to get soap that would have been sent to the web service here
clc.Close();
We have a SOAP proxy generated using Visual Studio connected services tooling (VS2017).
When we call an .asmx endpoint the SOAP proxy works perfectly.
When we communication to API Management endpoint, which is directed to go to
the same .asmx endpoint it fails.
When we communicate using Postman to API Managemenet endpoint the
call works, we took the HTTP headers and the SOAP body from a fiddler trace.
So in summary
We know the .asmx endpoint works when using the SOAP client and also postman.
We know API Management works over Postman, but not using the SOAP client generated by the tooling from the WCF.
We basically get back a 404 when calling API management and a small JSON body returned
{ "statusCode": 404, "message": "Resource not found" }
I just can't understand why the same response passed out over Postman works, but fails in the underlying WCF SOAP generated client.
Any one got an idea's why this may be failing?
One interesting thing to note is I tried the call using a HTTPClient, I passed in the headers and SOAP envelope and the call worked from C#. So it must be something to do with the underlying WCF infrastructure and API Management, but I just can't determine what that could be, particularly as the SOAP client works when talking to the ASMX service directly.
Just could not get to the bottom of this. I ended up rewriting the proxy manually using a HTTP client. I took the code generated XML entities from the tooling, removed all XML attributes and treated them just like POCO. I wrote a wrapper to generate the SOAP Envelope and read the corresponding result and serialize them back into the POCO objects.
Worked like a charm.
We need to test a web service which accepts JSON request. Server is implemented with WCF and REST API . Server response is asynchronous. I am thinking of below approach:
Approach 1: Use System.web and call UploadStringAsync
Approach 2: User asynchronous delegates in c#
I need to match response from server with request sent.
Is there any other better way to test REST API.
I need to develop test framework to test web service.
One part of testing a web service is testing what the web service does. You can do that with standard unit testing frameworks. This sort of testing has nothing to do with JSON or HTTP or REST, and that's a good thing. It will ensure that your service will work once you give it the correct JSON or HTTP or REST.
After you have tested the functionality of the service, you may want to write some other tests to make sure that the JSON, HTTP and REST part works. For that, you might use WebRequest or WebClient, or Visual Studio Web Tests.
I have a webservice [call it S1] exposed and clients call that service and get back response.So good so far.
I have to change my WSDL a bit [for some very odd reasons] but i dnt want clients to see the change. So my idea is to intercept the soap request somewhere b/w server and client and interceptor should modify the soap request and forward to the server.Similarly on response , again interceptor should intercept the request and change some property name and send it to the client.
Any idea how to do this? One approach IMO is to use handlers but here i dont have control over how server generates service from WSDL.
How can ESB help in this?
Please see its realtime application with huge requests to and from server!!!
An ESB like Mule ESB can help by acting as a proxy for your web service.
Can you not write a new web service with the new wsdl, then alter the old web service to simply call the new web service. A bit like overloading a method. That way you can have V1 and V2 web services.
At my last place we used to do a lot via XML SOAP - Basically the client would construct an XML request which would contain the service to invoke and send that onto a host and port
The server would then take that service request and figure out the class and method to call and serialise the request / response
This was helpful as we had Java and C# and wanted to segregate the two
If you had to build this out what libraries would you use?
Specifically how the main machine translates a service name => class and method invocation
In C# I'd look at WCF in the first instance, that allows you to create web services very simply.
For Java, I have experience with axis2 from Apache. It works well enough that I would recommend it and use it again on a SOAP project.