use of javax.xml.soap.SOAPBodyElement in project jbossws-cxf by jbossws.
the class LogHandler method handleOutbound.
@Override
protected boolean handleOutbound(SOAPMessageContext msgContext) {
log.info("handleOutbound");
try {
SOAPMessage soapMessage = msgContext.getMessage();
SOAPHeader soapHeader = getFailsafeSOAPHeader(soapMessage);
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
Name headerName = soapFactory.createName("LogHandlerOutbound", "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 + "|LogOut");
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
use of javax.xml.soap.SOAPBodyElement in project jbossws-cxf by jbossws.
the class RoutingHandler method handleInbound.
@Override
protected boolean handleInbound(SOAPMessageContext msgContext) {
log.info("handleInbound");
try {
SOAPMessage soapMessage = msgContext.getMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
Name headerName = soapFactory.createName("RoutingHandlerInbound", "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 + "|RoutIn");
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
use of javax.xml.soap.SOAPBodyElement in project jbossws-cxf by jbossws.
the class ServerHandler method handleFault.
@Override
public boolean handleFault(SOAPMessageContext msgContext) {
try {
SOAPMessage soapMessage = msgContext.getMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPBodyElement soapBodyElement = (SOAPBodyElement) soapBody.getChildElements().next();
SOAPElement faultStringElement = (SOAPElement) soapBodyElement.getChildElements(new QName("faultstring")).next();
faultStringElement.setValue(faultStringElement.getValue().toUpperCase());
Iterator<?> itDetail = soapBodyElement.getChildElements(new QName("detail"));
if (itDetail.hasNext()) {
Iterator<?> itException = ((SOAPElement) itDetail.next()).getChildElements(new QName("http://server.exception.samples.jaxws.ws.test.jboss.org/", "UserException"));
if (itException.hasNext()) {
SOAPElement messageElement = (SOAPElement) (((SOAPElement) itException.next()).getChildElements(new QName("message"))).next();
messageElement.setValue(messageElement.getValue().toUpperCase());
}
}
} catch (Exception e) {
throw new WebServiceException(e);
}
return true;
}
use of javax.xml.soap.SOAPBodyElement in project jbossws-cxf by jbossws.
the class AuthorizationHandler method handleInbound.
@Override
protected boolean handleInbound(SOAPMessageContext msgContext) {
log.info("handleInbound");
try {
SOAPMessage soapMessage = msgContext.getMessage();
SOAPHeader soapHeader = 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;
}
Aggregations