Methods Summary |
---|
static javax.xml.soap.SOAPFault | createFault(com.sun.xml.ws.api.SOAPVersion soapVer, TxFault fault, java.lang.String message)Create a SOAPFault from the specified information.
try {
final SOAPFactory soapFactory = soapVer.saajSoapFactory;
final SOAPFault soapFault = soapFactory.createFault();
if (soapVer == SOAPVersion.SOAP_11) {
soapFault.setFaultCode(fault.subcode);
soapFault.setFaultString(fault.reason + ": " + message, Locale.ENGLISH);
} else { // SOAP 1.2
soapFault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
soapFault.appendFaultSubcode(fault.subcode);
soapFault.setFaultString(fault.reason + ": " + message, Locale.ENGLISH);
}
return soapFault;
} catch (SOAPException e) {
throw new WebServiceException(e);
}
|
public static com.sun.xml.ws.api.addressing.WSEndpointReference | getFaultTo(javax.xml.ws.WebServiceContext wsContext)
HeaderList headers = getInboundHeaderList(wsContext);
return headers.getFaultTo(AddressingVersion.MEMBER, SOAPVersion.SOAP_11);
|
static com.sun.xml.ws.api.message.HeaderList | getInboundHeaderList(javax.xml.ws.WebServiceContext wsContext)
MessageContext msgContext = wsContext.getMessageContext();
return (HeaderList) msgContext.get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY);
|
public static java.lang.String | getMsgID(javax.xml.ws.WebServiceContext wsContext)
HeaderList headers = getInboundHeaderList(wsContext);
return headers.getMessageID(AddressingVersion.MEMBER, SOAPVersion.SOAP_11);
|
public static javax.xml.ws.EndpointReference | getReplyTo(javax.xml.ws.WebServiceContext wsContext)
HeaderList headers = getInboundHeaderList(wsContext);
return (headers.getReplyTo(AddressingVersion.MEMBER, SOAPVersion.SOAP_11)).toSpec();
|
public static void | sendFault(com.sun.xml.ws.api.addressing.WSEndpointReference faultTo, javax.xml.ws.EndpointReference replyTo, com.sun.xml.ws.api.SOAPVersion soapVer, TxFault fault, java.lang.String message, java.lang.String msgID)Dispatch a fault, adding any necessary headers to 'fault' in the process.
final WSEndpointReference to = faultTo != null ? faultTo : new WSEndpointReference(replyTo);
final WSService s = WSService.create();
final QName port = new QName("foo", "bar");
s.addPort(port, SOAPBinding.SOAP11HTTP_BINDING, to.getAddress());
// one-way feature
final OneWayFeature owf = new OneWayFeature();
owf.setRelatesToID(msgID);
// member submission addressing feature
final WebServiceFeature af = new MemberSubmissionAddressingFeature(true);
final Dispatch<Source> d = s.createDispatch(port, to, Source.class, Service.Mode.PAYLOAD, owf, af);
d.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
d.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, fault.actionURI);
d.invokeOneWay(new DOMSource(createFault(soapVer, fault, message)));
|
public static void | sendFault(javax.xml.ws.WebServiceContext wsContext, com.sun.xml.ws.api.SOAPVersion soapVer, TxFault fault, java.lang.String message)
String msgID = WsaHelper.getMsgID(wsContext);
EndpointReference replyTo = WsaHelper.getReplyTo(wsContext);
WSEndpointReference faultTo = WsaHelper.getFaultTo(wsContext);
sendFault(faultTo, replyTo, soapVer, fault, message, msgID);
|