use of javax.xml.soap.SOAPBodyElement in project jbossws-cxf by jbossws.
the class CustomHandler method handleInbound.
@Override
protected boolean handleInbound(SOAPMessageContext msgContext) {
try {
SOAPMessage soapMessage = msgContext.getMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPBodyElement soapBodyElement = (SOAPBodyElement) soapBody.getChildElements().next();
if (soapBodyElement.getChildElements().hasNext()) {
SOAPElement payload = (SOAPElement) soapBodyElement.getChildElements().next();
String value = payload.getValue();
payload.setValue(value + "World");
}
} catch (SOAPException 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 = ((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.SOAPBodyElement 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.SOAPBodyElement 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;
}
use of javax.xml.soap.SOAPBodyElement in project jbossws-cxf by jbossws.
the class AuthorizationHandler 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("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;
}
Aggregations