use of com.sun.xml.ws.api.addressing.AddressingVersion in project metro-jax-ws by eclipse-ee4j.
the class Fiber method dumpFiberContext.
private void dumpFiberContext(String desc) {
if (isTraceEnabled()) {
String action = null;
String msgId = null;
if (packet != null) {
for (SOAPVersion sv : SOAPVersion.values()) {
for (AddressingVersion av : AddressingVersion.values()) {
action = packet.getMessage() != null ? AddressingUtils.getAction(packet.getMessage().getHeaders(), av, sv) : null;
msgId = packet.getMessage() != null ? AddressingUtils.getMessageID(packet.getMessage().getHeaders(), av, sv) : null;
if (action != null || msgId != null) {
break;
}
}
if (action != null || msgId != null) {
break;
}
}
}
String actionAndMsgDesc;
if (action == null && msgId == null) {
actionAndMsgDesc = "NO ACTION or MSG ID";
} else {
actionAndMsgDesc = "'" + action + "' and msgId '" + msgId + "'";
}
String tubeDesc;
if (next != null) {
tubeDesc = next + ".processRequest()";
} else {
tubeDesc = peekCont() + ".processResponse()";
}
LOGGER.log(Level.FINE, "{0} {1} with {2} and ''current'' tube {3} from thread {4} with Packet: {5}", new Object[] { getName(), desc, actionAndMsgDesc, tubeDesc, Thread.currentThread().getName(), packet != null ? packet.toShortString() : null });
}
}
use of com.sun.xml.ws.api.addressing.AddressingVersion in project metro-jax-ws by eclipse-ee4j.
the class AddressingUtils method fillRequestAddressingHeaders.
// private void fillRequestAddressingHeaders(Packet packet, AddressingVersion av, SOAPVersion sv, OneWayFeature oneWayFeature, boolean oneway, String action);
public static void fillRequestAddressingHeaders(MessageHeaders headers, WSDLPort wsdlPort, WSBinding binding, Packet packet) {
if (binding == null) {
throw new IllegalArgumentException(AddressingMessages.NULL_BINDING());
}
if (binding.isFeatureEnabled(SuppressAutomaticWSARequestHeadersFeature.class)) {
return;
}
// See if WSA headers are already set by the user.
MessageHeaders hl = packet.getMessage().getHeaders();
String action = AddressingUtils.getAction(hl, binding.getAddressingVersion(), binding.getSOAPVersion());
if (action != null) {
// assume that all the WSA headers are set by the user
return;
}
AddressingVersion addressingVersion = binding.getAddressingVersion();
// seiModel is passed as null as it is not needed.
WsaTubeHelper wsaHelper = addressingVersion.getWsaHelper(wsdlPort, null, binding);
// wsa:Action
String effectiveInputAction = wsaHelper.getEffectiveInputAction(packet);
if (effectiveInputAction == null || effectiveInputAction.equals("") && binding.getSOAPVersion() == SOAPVersion.SOAP_11) {
throw new WebServiceException(ClientMessages.INVALID_SOAP_ACTION());
}
boolean oneway = !packet.expectReply;
if (wsdlPort != null) {
// the SOAP message with non-anonymous ReplyTo/FaultTo.
if (!oneway && packet.getMessage() != null && packet.getWSDLOperation() != null) {
WSDLBoundOperation wbo = wsdlPort.getBinding().get(packet.getWSDLOperation());
if (wbo != null && wbo.getAnonymous() == WSDLBoundOperation.ANONYMOUS.prohibited) {
throw new WebServiceException(AddressingMessages.WSAW_ANONYMOUS_PROHIBITED());
}
}
}
OneWayFeature oneWayFeature = binding.getFeature(OneWayFeature.class);
final AddressingPropertySet addressingPropertySet = packet.getSatellite(AddressingPropertySet.class);
oneWayFeature = addressingPropertySet == null ? oneWayFeature : new OneWayFeature(addressingPropertySet, addressingVersion);
if (oneWayFeature == null || !oneWayFeature.isEnabled()) {
// standard oneway
fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneway, effectiveInputAction, AddressingVersion.isRequired(binding));
} else {
// custom oneway
fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneWayFeature, oneway, effectiveInputAction);
}
}
use of com.sun.xml.ws.api.addressing.AddressingVersion in project metro-jax-ws by eclipse-ee4j.
the class ReplaceAddressingHeaderTest method testReplaceBehavior.
public void testReplaceBehavior() throws Exception {
String reqMsgStr = "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">" + "<env:Header>" + "<r:AckRequested xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:r=\"http://docs.oasis-open.org/ws-rx/wsrm/200702\" xmlns:a=\"http://www.w3.org/2005/08/addressing\">" + "<r:Identifier>uuid:WLS2:store:WseeJaxwsFileStore:dece97a1d44772e7:-3fbed9f:13b4b7da0a6:-7fb6</r:Identifier>" + "</r:AckRequested>" + "<a:Action xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:r=\"http://docs.oasis-open.org/ws-rx/wsrm/200702\" " + "xmlns:a=\"http://www.w3.org/2005/08/addressing\" s:mustUnderstand=\"1\">http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested</a:Action>" + "<a:To xmlns:s=\"http://www.w3.org/2003/05/soap-envelop\" " + "xmlns:r=\"http://docs.oasis-open.org/ws-rx/wsrm/200702\" xmlns:a=\"http://www.w3.org/2005/08/addressing\" " + "s:mustUnderstand=\"1\">http://10.245.29.191:9902/ReliableMessaging_Service_WSAddressing10_Indigo/OneWay.svc/Reliable_Addressable_Soap12_WSAddressing10_RM11</a:To>" + "</env:Header>" + "<env:Body/>" + "</env:Envelope>";
String respMsgStr = "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">" + "<env:Header>" + "<Action xmlns=\"http://www.w3.org/2005/08/addressing\">http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement</Action>" + "<wsrm11:SequenceAcknowledgement xmlns:wsrm11=\"http://docs.oasis-open.org/ws-rx/wsrm/200702\">" + "<wsrm11:Identifier>uuid:WLS2:store:WseeJaxwsFileStore:dece97a1d44772e7:-3fbed9f:13b4b7da0a6:-7fb6</wsrm11:Identifier>" + "<wsrm11:AcknowledgementRange Lower=\"1\" Upper=\"3\"/>" + "</wsrm11:SequenceAcknowledgement>" + "<To xmlns=\"http://www.w3.org/2005/08/addressing\">" + "http://10.244.13.245:8000/bcabf5e4-d888-403c-a93e-99ed5e7f4a40/fe5c31e3-a8af-40ed-8066-e41c3ba9f742</To>" + "<ns0:ReplyTo xmlns:ns0=\"http://www.w3.org/2005/08/addressing\">" + "<ns0:Address>" + "http://10.245.29.191:9902/ReliableMessaging_Service_WSAddressing10_Indigo/OneWay.svc/Reliable_Addressable_Soap12_WSAddressing10_RM11" + "</ns0:Address>" + "<ns0:Metadata xmlns:ns1=\"http://www.w3.org/ns/wsdl-instance\" " + "ns1:wsdlLocation=\"http://tempuri.org/http://10.245.29.191:9902/ReliableMessaging_Service_WSAddressing10_Indigo/OneWay.svc/Reliable_Addressable_Soap12_WSAddressing10_RM11?wsdl\">" + "<wsam:InterfaceName xmlns:wsam=\"http://www.w3.org/2007/05/addressing/metadata\" xmlns:wsns=\"http://tempuri.org/\">" + "wsns:IPing</wsam:InterfaceName>" + "<wsam:ServiceName xmlns:wsam=\"http://www.w3.org/2007/05/addressing/metadata\" xmlns:wsns=\"http://tempuri.org/\" EndpointName=\"CustomBinding_IPing10\">" + "wsns:PingService</wsam:ServiceName>" + "</ns0:Metadata>" + "</ns0:ReplyTo>" + "</env:Header>" + "<env:Body/></env:Envelope>";
AddressingVersion av = AddressingVersion.W3C;
SOAPVersion sv = SOAPVersion.SOAP_12;
String action = "http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement";
SAAJMessage reqMsg = new SAAJMessage(makeSOAPMessage(reqMsgStr));
SAAJMessage respMsg = new SAAJMessage(makeSOAPMessage(respMsgStr));
HeaderList hdrs = (HeaderList) respMsg.getHeaders();
String originToHeader = hdrs.getTo(av, sv);
Packet responsePacket = null;
try {
responsePacket = new Packet(reqMsg).createServerResponse(respMsg, av, sv, action);
} catch (Exception e) {
e.printStackTrace();
}
// check toHeader
String toHeaderAfterProcessed = AddressingUtils.getTo(responsePacket.getHeaderList(), av, sv);
assertTrue(toHeaderAfterProcessed.equals(originToHeader));
}
Aggregations