use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.
the class AuthorizationHandler method handleInbound.
@Override
protected boolean handleInbound(SOAPMessageContext msgContext) {
log.info("handleInbound");
try {
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
soapMessage.getSOAPHeader();
SOAPBody soapBody = soapMessage.getSOAPBody();
// SOAPFactory soapFactory = SOAPFactory.newInstance();
// Name headerName = soapFactory.createName("AuthorizationHandlerInbound", "ns1", "http://somens");
// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
// she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement) soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement) soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
soapElement.setValue(value + "|AuthIn");
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.
the class AuthorizationHandler method handleOutbound.
@Override
protected boolean handleOutbound(SOAPMessageContext msgContext) {
log.info("handleOutbound");
try {
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
soapMessage.getSOAPHeader();
SOAPBody soapBody = soapMessage.getSOAPBody();
// SOAPFactory soapFactory = SOAPFactory.newInstance();
// Name headerName = soapFactory.createName("AuthorizationHandlerOutbound", "ns1", "http://somens");
// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
// she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement) soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement) soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
soapElement.setValue(value + "|AuthOut");
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.
the class ServerSOAPHandler method handleOutbound.
@Override
protected boolean handleOutbound(final SOAPMessageContext msgContext) {
try {
SOAPMessage message = msgContext.getMessage();
SOAPBody body = message.getSOAPBody();
Document document = body.extractContentAsDocument();
NodeList nodes = document.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node current = nodes.item(i);
NodeList childNodes = current.getChildNodes();
for (int j = 0; j < childNodes.getLength(); j++) {
Node currentChildNode = childNodes.item(j);
if ("return".equals(currentChildNode.getLocalName())) {
currentChildNode.setTextContent("PutByServerSOAPHandler");
}
}
}
body.addDocument(document);
message.saveChanges();
} catch (SOAPException e) {
throw new RuntimeException(e);
}
return true;
}
use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.
the class CustomHandler method handleMessage.
@Override
public boolean handleMessage(SOAPMessageContext context) {
log.debug("handleMessage...");
try {
SOAPMessageContext msgContext = context;
SOAPBody body = msgContext.getMessage().getSOAPBody();
String bodyStr = DOMWriter.printNode(body, false);
if (bodyStr.indexOf("http://example.org/sei") < 0)
throw new WebServiceException("Invalid body: " + bodyStr);
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
return true;
}
use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.
the class RoutingHandler method handleOutbound.
@Override
protected boolean handleOutbound(SOAPMessageContext msgContext) {
log.info("handleOutbound");
try {
SOAPMessage soapMessage = msgContext.getMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
Name headerName = soapFactory.createName("RoutingHandlerOutbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement) soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement) soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
soapElement.setValue(value + "|RoutOut");
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
Aggregations