use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class EndpointHandler 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("EndpointHandlerInbound", "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 + "|EpIn");
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class DescriptorResourcesHandler method ensureInjectionsAndInitialization.
private boolean ensureInjectionsAndInitialization(MessageContext msgContext, String direction) {
if (!this.correctState) {
throw new WebServiceException("Unfunctional javax.annotation.* annotations");
}
try {
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
soapElement = (SOAPElement) soapElement.getChildElements().next();
String oldValue = soapElement.getValue();
String newValue = oldValue + ":" + direction + ":DescriptorResourcesHandler";
soapElement.setValue(newValue);
log.debug("oldValue: " + oldValue);
log.debug("newValue: " + newValue);
return true;
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class JavaResourcesHandler method ensureInjectionsAndInitialization.
private boolean ensureInjectionsAndInitialization(MessageContext msgContext, String direction) {
if (!this.correctState) {
throw new WebServiceException("Unfunctional javax.annotation.* annotations");
}
try {
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
soapElement = (SOAPElement) soapElement.getChildElements().next();
String oldValue = soapElement.getValue();
String newValue = oldValue + ":" + direction + ":JavaResourcesHandler";
soapElement.setValue(newValue);
log.debug("oldValue: " + oldValue);
log.debug("newValue: " + newValue);
return true;
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class MTOMProtocolHandler method verifyXOPPackage.
private boolean verifyXOPPackage(MessageContext context) {
try {
SOAPMessageContext msgContext = (SOAPMessageContext) context;
SOAPMessage soapMsg = msgContext.getMessage();
SOAPEnvelope soapEnv = soapMsg.getSOAPPart().getEnvelope();
SOAPBody body = soapEnv.getBody();
boolean found = scanNodes(body.getChildNodes());
if (found)
throw new IllegalStateException("XOP request not properly inlined");
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
return true;
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class CDIHandler method handleInbound.
@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
if (bean == null) {
throw new RuntimeException("Injection doesn't work");
}
try {
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
soapElement = (SOAPElement) soapElement.getChildElements().next();
String oldValue = soapElement.getValue();
String newValue = "Mr. " + oldValue;
soapElement.setValue(newValue);
return true;
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
}
Aggregations