Tuesday, 24 February 2009

Working with web services - Checking the web service connection

I've recently been working on a web service integration. It's a big task with integration tests, unit tests, WSDLs, the full works. To give it a bit more background the web service expects a quote object that gets populated by us and then passed across to the web service. We then get a response which is either an error(!) or more hopefully a list of quote responses that we can bind to a datagrid.

To start with the web service integration went well. Downloaded the schema from the WSDL, got the required quote object unit tested to make sure it was being populated correctly. All looking good, so went onto an integration test that would use test data to populate the quote object and pass it over.

Now it all fell apart
! Kept getting a rubbish 'Quote refused' error. This made me think of authentication problems so checked the username and passwords but they proved to be setup correctly. I was really coming to a block on the task when a collegue suggested downloading SoapUI to see what was going on with the web service connection. Turn out to be a good shout...

You can find SoapUI here - http://www.soapui.org/. It allows you to add a WSDL from either a URL location or from a file on your machine. As long as the WSDL is genuine, SoapUI returns a list of objects and double clicking on them generates example XML requests which you can send to the web service (click the green arrow top left).

Soap UI screen shot here

It proved to be a good idea because when we tried to setup SoapUI with our third parties WSDL the schemas came down fine but sending XML returned an 'UnknownHostException'. I sent the screen grab to the third party who confirmed the WSDL we had been given was incorrect (essentially it contained the wrong web service URLs). Change of WSDL and 5mins later we were connecting with SoapUI.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home