metro-jax-ws
metro-jax-ws copied to clipboard
For certain cases, RI method com.sun.xml.ws.api.message.Message.isOneWay(WSDLPort port) does not return correct result
Method com.sun.xml.ws.api.message.Message.isOneWay(WSDLPort) can return a wrong value for certain cases and this is a problem for whoever is using this method. E.g. com.sun.xml.ws.api.message.Packet.relateServerResponse(Packet, WSDLPort, SEIModel, WSBinding) uses this method.
Find that com.sun.xml.ws.api.message.Message.isOneWay(WSDLPort) is using deprecated com.sun.xml.ws.api.message.Message.getOperation(WSDLPort) method and that looks to be the culprit.
To reproduce this issue, use attached HelloService.wsdl that has one-way and two-way operations (mixed) under one binding. You should find that when you invoke a two-way operation, Message.isOneWay(WSDLPort) returns true and that results in Packet.relateServerResponse method not adding any response addressing headers to the response Packet.
The fix could be as simple as adding a new 'com.sun.xml.ws.api.message.Message.isOneWay(WSDLPort port, QName opName)' method that can be called by whoever needs correct result from Message.isOneWay. Packet.relateServerResponse can use this new method (it can use com.sun.xml.ws.api.message.Packet.getWSDLOperation() method to find the QName opName to supply it to this new method). Below is the pseudo code for the new Message.isOneWay(WSDLPort port, QName opName) method:
if (opName != null) { WSDLBoundOperation op = port.getBinding().getOperation(opName.getNamespaceURI(), opName.getLocalPart()); if (op != null)
{ boolean oneWay = op.getOperation().isOneWay(); }
}
Environment
64-bit Linux, Oracle JRockit(R) (build R28.2.0-79-146777-1.6.0_29-20111005-1807-linux-x86_64, compiled mode)
Affected Versions
[current]
Source: https://github.com/javaee/metro-jax-ws/issues/1061 Author: glassfishrobot