Hello all, Currently, there is a comment in the AddressingFinalInHandler to the effect that if no wsa:To header is found in an inbound request message then we do not use the wsa:Anonymous URL as its default value. This is to allow an alternative, such as the transport URL, to be used instead. I believe that this is the wrong option for the following reasons:
1) It is not compliant with the WS-Addressing core spec. 2) It prevents us from optimising the set of WS-Addressing headers included in a message. Consider the following request: <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsa:To>http://localhost:8081/axis2/services/MyService</wsa:To> <wsa:ReplyTo> <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address> </wsa:ReplyTo> <wsa:MessageID>urn:uuid:7A171A9933336AC3CC11641979655001</wsa:MessageID> <wsa:Action>urn:echo</wsa:Action> </soapenv:Header> <soapenv:Body> ..... </soapenv:Body> </soapenv:Envelope> it will result in the following response: <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To> <wsa:ReplyTo> <wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address> </wsa:ReplyTo> <wsa:MessageID>urn:uuid:0839A16552C8EF67E911641979660934</wsa:MessageID> <wsa:Action>urn:echo</wsa:Action> <wsa:RelatesTo wsa:RelationshipType=" http://www.w3.org/2005/08/addressing/reply ">urn:uuid:7A171A9933336AC3CC11641979655001</wsa:RelatesTo> </soapenv:Header> <soapenv:Body> ..... </soapenv:Body> </soapenv:Envelope> Instead what we would prefer that the following request be sent: <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsa:To>http://localhost:8081/axis2/services/MyService</wsa:To> <wsa:MessageID>urn:uuid:7A171A9933336AC3CC11641979655001</wsa:MessageID> <wsa:Action>urn:echo</wsa:Action> </soapenv:Header> <soapenv:Body> ..... </soapenv:Body> </soapenv:Envelope> which would provoke the following response: <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsa:ReplyTo> <wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address> </wsa:ReplyTo> <wsa:MessageID>urn:uuid:0839A16552C8EF67E911641979660934</wsa:MessageID> <wsa:Action>urn:echo</wsa:Action> <wsa:RelatesTo>urn:uuid:7A171A9933336AC3CC11641979655001</wsa:RelatesTo> </soapenv:Header> <soapenv:Body> ..... </soapenv:Body> </soapenv:Envelope> Notice that in the second request-response pair we are able to leave out optional headers, as they contain values that match the defaults specified in the spec. In the request we omitted the wsa:ReplyTo header. In the response we omitted the wsa:To header (and the relationship type attribute of the wsa:RelatesTo header). The current Axis2 behaviour prevents us from generating a response message that omits the wsa:To field. The benefit of doing this is a performance one, i.e. fewer SOAP headers => better performance. I am proposing that axis2 provide the following behaviour instead: 1) If ws-addressing is not engaged then the transport URL can be used to identify the service 2) if ws-addressing is engaged, but there are no ws-addressing headers in the message then the transport URL can be used to identify the service 3) if ws-addressing is engaged, and there are ws-addressing headers in the message, and one of them is the wsa:To header then it will be used to determine the service. 4) if ws-addressing is engaged, and there are ws-addressing headers in the message, and the wsa:To header is not one of them then the default value will be used ( Note: For an inbound request message, an address of wsa:Anonymous will likely result in a "Service not found" fault. This means that, if addressing is being used, the wsa:To field of a request message should always be provided explicitly. For a response message, the AddressingBasedDispatcher will use the wsa:RelatesTo field to correlate the response to the original request, so dispatching is not an issue in this case.) All comments welcome. Cheers Brian DePradine Web Services Development IBM Hursley External +44 (0) 1962 816319 Internal 246319 If you can't find the time to do it right the first time, where will you find the time to do it again?