0

I have a WSDL message that is composed of two parts:

<wsdl:message name="GenericWebServiceOperationRequestMessage">
    <wsdl:part name="Body" element="ns:MyRequest"/>
    <wsdl:part name="Security" element="ns:Security"/>
</wsdl:message>

The workflow I am using is running xjc.exe on the wsdl to generate the JAXB artifacts and then using them to call the webservice. Well that's all good, except I cannot figure out what the right workflow is to invoke a message that has mutliple parts using Spring WebServiceTemplate. I can create the MyRequest and Security objects (which are complex types), but the function:

WebServiceTemplate().marshalSendAndReceive(Object requestPayload); Only takes a single object. Not parts... What's the right way to call this type of Web Service Operation?

IcedDante
  • 6,145
  • 12
  • 57
  • 100

1 Answers1

0

I suppose the reason I received no answer is because this is not possible. If I'm wrong, please correct me, but it appears that WebServiceTemplate only supports wrapped Web Service calls. That is, operations that only send a single input and receive a single output object.

For situations like this where you have two or more objects aligned the only solution I can see is to create the most complex object and use the Webservice callback function in the call to manually create the SOAP elements onto the body or header as needed.

Use WebServiceMessageCallback in the marshalSendAndReceive() call, and in the doWithMessage(WebServiceMessage message) function, I use

SOAPMessage soapMessage = ((SaajSoapMessage)message).getSaajMessage();

to get and modify the soap message.

IcedDante
  • 6,145
  • 12
  • 57
  • 100