There are basically ii things ii accept note, take in comments inwards code.
//#1 - inject WebServiceContext @Resource somebody WebServiceContext webServiceContext; //#2 give-up the ghost the soapMessage, add together a soapFault inwards trunk in addition to throw the soapFault exception. SOAPMessageContext jaxwsContext = (SOAPMessageContext) webServiceContext.getMessageContext(); SOAPMessage soapMsg = jaxwsContext.getMessage(); endeavour { SOAPFault soapFault = soapMsg.getSOAPBody().addFault(); soapFault.setFaultString("ERROR"); Name qname = soapMsg.getSOAPPart().getEnvelope().createName("Client", null, SOAPConstants.URI_NS_SOAP_ENVELOPE); soapFault.setFaultCode(qname); throw novel SOAPFaultException(soapFault); } choose grip of (SOAPException e) { // TODO Auto-generated choose grip of block e.printStackTrace(); }
0 komentar:
Please comment if there are any that need to be asked.