Friday, February 07, 2014

Continue: How WebServiceTemplate Look Like

So now we come down to the spring-ws which is relatively new to me. My goal is to access a SOAP web service and my plan is to create POJO requests and receive POJO responses by using the marshallSendAndReceive from WebServiceTemplate.

Here is how I define the beans in app2Context.xml.



You can see I let CastorMarshaller to handle marshaling and unmarshaling, which I will talk about later.

Now I would show you how the code look like.



You can see I create a WebServiceMessageCallback to handle the namespace, simply because I can't find a declarative way to get it into the SOAP XML request. If any of you know how, please let me know. Or you can confirm with me this is actually the right way to go.

This method is rather simple because I let CastorMarshaller mapping to do the heavy lifting.

No comments: