use of com.sun.xml.ws.api.model.WSDLOperationMapping in project metro-jax-ws by eclipse-ee4j.
the class ActionBasedOperationFinder method getWSDLOperationMapping.
public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
MessageHeaders hl = request.getMessage().getHeaders();
String action = AddressingUtils.getAction(hl, av, binding.getSOAPVersion());
if (action == null)
// Addressing is not enagaged, return null to use other ways to dispatch.
return null;
Message message = request.getMessage();
QName payloadName;
String localPart = message.getPayloadLocalPart();
if (localPart == null) {
payloadName = PayloadQNameBasedOperationFinder.EMPTY_PAYLOAD;
} else {
String nsUri = message.getPayloadNamespaceURI();
if (nsUri == null)
nsUri = PayloadQNameBasedOperationFinder.EMPTY_PAYLOAD_NSURI;
payloadName = new QName(nsUri, localPart);
}
WSDLOperationMapping opMapping = uniqueOpSignatureMap.get(new ActionBasedOperationSignature(action, payloadName));
if (opMapping != null)
return opMapping;
// Seems like in Wstrust STS wsdls, the payload does not match what is specified in the wsdl leading to incorrect
// wsdl operation resolution. Use just wsa:Action to dispatch as a last resort.
// try just with wsa:Action
opMapping = actionMap.get(action);
if (opMapping != null)
return opMapping;
// invalid action header
Message result = Messages.create(action, av, binding.getSOAPVersion());
throw new DispatchException(result);
}
use of com.sun.xml.ws.api.model.WSDLOperationMapping in project metro-jax-ws by eclipse-ee4j.
the class OperationDispatcher method getWSDLOperationMapping.
/**
* @param request Packet
* @return the wsdl operation.
* @throws DispatchException if a unique operartion cannot be associated with this packet.
*/
@NotNull
public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
WSDLOperationMapping opName;
for (WSDLOperationFinder finder : opFinders) {
opName = finder.getWSDLOperationMapping(request);
if (opName != null)
return opName;
}
// No way to dispatch this request
String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]", request.soapAction, request.getMessage().getPayloadNamespaceURI(), request.getMessage().getPayloadLocalPart());
String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err);
Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage(binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient);
throw new DispatchException(faultMsg);
}
use of com.sun.xml.ws.api.model.WSDLOperationMapping in project metro-jax-ws by eclipse-ee4j.
the class PayloadQNameBasedOperationFinder method getWSDLOperationMapping.
/**
* @return not null if it finds a unique handler for the request
* null if it cannot identify a unique wsdl operation from the Payload QName.
*
* @throws DispatchException if the payload itself is incorrect, this happens when the payload is not accepted by
* any operation in the port.
*/
public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
Message message = request.getMessage();
String localPart = message.getPayloadLocalPart();
String nsUri;
if (localPart == null) {
localPart = EMPTY_PAYLOAD_LOCAL;
nsUri = EMPTY_PAYLOAD_NSURI;
} else {
nsUri = message.getPayloadNamespaceURI();
if (nsUri == null)
nsUri = EMPTY_PAYLOAD_NSURI;
}
WSDLOperationMapping op = methodHandlers.get(nsUri, localPart);
// Check if payload itself is correct. Usually it is, so let us check last
if (op == null && !unique.containsKey(nsUri, localPart)) {
String dispatchKey = "{" + nsUri + "}" + localPart;
String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(dispatchKey);
throw new DispatchException(SOAPFaultBuilder.createSOAPFaultMessage(binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient));
}
return op;
}
use of com.sun.xml.ws.api.model.WSDLOperationMapping in project metro-jax-ws by eclipse-ee4j.
the class WsaTubeHelper method getOutputAction.
public String getOutputAction(Packet packet) {
// String action = AddressingVersion.UNSET_OUTPUT_ACTION;
String action = null;
WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
if (wsdlOp != null) {
JavaMethod javaMethod = wsdlOp.getJavaMethod();
if (javaMethod != null) {
JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
return jm.getOutputAction();
}
}
WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
if (wbo != null)
return getOutputAction(wbo);
}
return action;
}
use of com.sun.xml.ws.api.model.WSDLOperationMapping in project metro-jax-ws by eclipse-ee4j.
the class WsaTubeHelper method getFaultActionFromSEIModel.
String getFaultActionFromSEIModel(Packet requestPacket, Packet responsePacket) {
String action = null;
if (seiModel == null || wsdlPort == null) {
return action;
}
try {
SOAPMessage sm = responsePacket.getMessage().copy().readAsSOAPMessage();
if (sm == null) {
return action;
}
if (sm.getSOAPBody() == null) {
return action;
}
if (sm.getSOAPBody().getFault() == null) {
return action;
}
Detail detail = sm.getSOAPBody().getFault().getDetail();
if (detail == null) {
return action;
}
String ns = detail.getFirstChild().getNamespaceURI();
String name = detail.getFirstChild().getLocalName();
WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping();
JavaMethodImpl jm = (wsdlOp != null) ? (JavaMethodImpl) wsdlOp.getJavaMethod() : null;
if (jm != null) {
for (CheckedExceptionImpl ce : jm.getCheckedExceptions()) {
if (ce.getDetailType().tagName.getLocalPart().equals(name) && ce.getDetailType().tagName.getNamespaceURI().equals(ns)) {
return ce.getFaultAction();
}
}
}
return action;
} catch (SOAPException e) {
throw new WebServiceException(e);
}
}
Aggregations