Oct 21st, 2007, 11:18 PM
Whether to Use WebServiceTemplate OR Wire the proxy classes for webservice consumptio
I would like to take expert opinion about consuming WebService using the WebServiceTemplate of SpringWS or the traditional style of wiring the proxy classes generated from the wsdl for the below scenario.
1) Webservices are exposed by WebMethods . They are on version SOAP 1.1, WSDL 1.0.
2) Its not a contract first style of webservice consumption (SpringWs) but rather a top-down style . So there is no agreed upon common xsd definition .
3) The wsdl are available for consumption and is provided by the WebMethod team. The requirement is to consume it on the Java side which has a SpringMVC based framework and it would be easy to integrate further withe SpringWS.
4) Its document(literal ) style based .
Keeping the above requirements in mind, is it advisable to
1) Consume WebServices using the WebServiceTemplate
2) Generate the proxy class from the wsdl provided from the WebMethod team and then wire the bindings, locators and ports .
The second approach appears clumsy and can go cryptic whereas the first one using SpringWS looks starighforward , but as i mentioned there it is not contract first and there is no common defined xsd defined. We need to consume whatever is published by WebMethod.
Would like to have your opinion on both the approach and which one seems to be way to go.
Oct 22nd, 2007, 10:55 AM
Well, if the wsdl changes constantly, you are basically screwed with either approach.
Besides that, either one will work. Spring-WS does not require contract-first on the server side, though it is a best practice.
Oct 22nd, 2007, 03:47 PM
Based on the above scenario , if i use Spring WebServiceTemplate can you validate the steps.
1) Put the endpoint as the defaultUri .
2) Invoke the sendAndResponse method of the WebServiceTemplate .
3) Wire the marshaller/Unmarshaller with the sendAndResponse () to convert XML to Java .
Is there anything else which i need to consume the webservice.
Oct 23rd, 2007, 02:51 PM
Nope, that is it, pretty much.