Announcement Announcement Module
No announcement yet.
Whether to Use WebServiceTemplate OR Wire the proxy classes for webservice consumptio Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.


  • #2
    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.


    • #3

      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.



      • #4
        Nope, that is it, pretty much.