use of com.sun.xml.ws.api.SOAPVersion in project metro-jax-ws by eclipse-ee4j.
the class SAAJFactory method readAsSAAJ.
/**
* Reads the message within the Packet to a SAAJMessage. After this call message is consumed.
* @param packet Packet
* @return Created SAAJPMessage
* @throws SOAPException if SAAJ processing fails
*/
public SAAJMessage readAsSAAJ(Packet packet) throws SOAPException {
SOAPVersion v = packet.getMessage().getSOAPVersion();
SOAPMessage msg = readAsSOAPMessage(v, packet.getMessage());
return new SAAJMessage(msg);
}
use of com.sun.xml.ws.api.SOAPVersion in project metro-jax-ws by eclipse-ee4j.
the class HeaderList method getNotUnderstoodHeaders.
@Override
public Set<QName> getNotUnderstoodHeaders(Set<String> roles, Set<QName> knownHeaders, WSBinding binding) {
Set<QName> notUnderstoodHeaders = null;
if (roles == null) {
roles = new HashSet<>();
}
SOAPVersion effectiveSoapVersion = getEffectiveSOAPVersion(binding);
roles.add(effectiveSoapVersion.implicitRole);
for (int i = 0; i < size(); i++) {
if (!isUnderstood(i)) {
Header header = get(i);
if (!header.isIgnorable(effectiveSoapVersion, roles)) {
QName qName = new QName(header.getNamespaceURI(), header.getLocalPart());
if (binding == null) {
// check above
if (notUnderstoodHeaders == null) {
notUnderstoodHeaders = new HashSet<>();
}
notUnderstoodHeaders.add(qName);
} else {
// if the binding is not null, see if the binding can understand it
if (binding instanceof SOAPBindingImpl && !((SOAPBindingImpl) binding).understandsHeader(qName)) {
if (!knownHeaders.contains(qName)) {
// logger.info("Element not understood=" + qName);
if (notUnderstoodHeaders == null) {
notUnderstoodHeaders = new HashSet<>();
}
notUnderstoodHeaders.add(qName);
}
}
}
}
}
}
return notUnderstoodHeaders;
}
use of com.sun.xml.ws.api.SOAPVersion 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.SOAPVersion 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));
}
use of com.sun.xml.ws.api.SOAPVersion in project metro-jax-ws by eclipse-ee4j.
the class SOAPMessageContextImpl method getHeaders.
public Object[] getHeaders(QName header, JAXBContext jaxbContext, boolean allRoles) {
SOAPVersion soapVersion = binding.getSOAPVersion();
List<Object> beanList = new ArrayList<>();
try {
Iterator<Header> itr = packet.getMessage().getHeaders().getHeaders(header, false);
if (allRoles) {
while (itr.hasNext()) {
beanList.add(itr.next().readAsJAXB(jaxbContext.createUnmarshaller()));
}
} else {
while (itr.hasNext()) {
Header soapHeader = itr.next();
// Check if the role is one of the roles on this Binding
String role = soapHeader.getRole(soapVersion);
if (getRoles().contains(role)) {
beanList.add(soapHeader.readAsJAXB(jaxbContext.createUnmarshaller()));
}
}
}
return beanList.toArray();
} catch (Exception e) {
throw new WebServiceException(e);
}
}
Aggregations