I'm implementing a SOAP-based web-service and have got WS-Addressing working. However, I can't see how to get the WSDL to publish what the client should use as the value of the wsa:To element.
I have used the snippet below in my WSDL, and used SOAP-UI to generate a request. It seems that SOAP-UI recognises that wsa:action should be set to "http://myco.com/myOperation", although it doesn't add this header automatically. I have to select the "Add WS-A Headers" menu option.
My problem is that it doesn't add a wsa:To header. Can anyone tell me how I amend my WSDL to tell clients that a wsa:To is required and that its value should be "http://myco.com/cap/services/v1"?
Thanks
<wsdl:portType name="MyPortType">
<wsdl:operation name="MyOperation">
<wsdl:input message="tns:MyRequestMessage" name="Request"
wsaw:Action="http://myco.com/myOperation"/>
<wsdl:output message="tns:MyResponseMessage" name="Response"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyBinding" type="tns:MyPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsaw:UsingAddressing wsdl:required="true"/>
<wsdl:operation name="MyOperation">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port binding="tns:MyBinding" name="MyPort">
<soap:address location="http://myco.com/services"/>
<wsa:Address>http://myco.com/cap/services/v1</wsa:Address>
</wsdl:port>
</wsdl:service>
To achieve this I defined the namespace for ws addressing 2005 version
<xs:schema ... xmlns:wsa5="http://www.w3.org/2005/08/addressing">
....
</xs:schema>
a message type
<wsdl:message name="wsaHeader">
<wsdl:part name="MessageID" element="wsa5:MessageID" />
<wsdl:part name="RelatesTo" element="wsa5:RelatesTo" />
<wsdl:part name="From" element="wsa5:From" />
<wsdl:part name="ReplyTo" element="wsa5:ReplyTo" />
<wsdl:part name="FaultTo" element="wsa5:FaultTo" />
<wsdl:part name="To" element="wsa5:To" />
<wsdl:part name="Action" element="wsa5:Action" />
</wsdl:message>
Then in my input and output I placed the following tags.
<wsdl:input>
<soap:header use="literal" message="tns:wsaHeader" part="Action"/>
<soap:header use="literal" message="tns:wsaHeader" part="To"/>
<soap:header use="literal" message="tns:wsaHeader" part="FaultTo"/>
<soap:header use="literal" message="tns:wsaHeader" part="ReplyTo"/>
<soap:header use="literal" message="tns:wsaHeader" part="From"/>
<soap:header use="literal" message="tns:wsaHeader" part="RelatesTo"/>
<soap:header use="literal" message="tns:wsaHeader" part="MessageID"/>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:header use="literal" message="tns:wsaHeader" part="Action"/>
<soap:header use="literal" message="tns:wsaHeader" part="To"/>
<soap:header use="literal" message="tns:wsaHeader" part="FaultTo"/>
<soap:header use="literal" message="tns:wsaHeader" part="ReplyTo"/>
<soap:header use="literal" message="tns:wsaHeader" part="From"/>
<soap:header use="literal" message="tns:wsaHeader" part="RelatesTo"/>
<soap:header use="literal" message="tns:wsaHeader" part="MessageID"/>
<soap:body use="literal" />
</wsdl:output>
You may only need to add the To
tag for your purposes.