Search in sources :

Example 91 with SOAPException

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 = 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;
}
Also used : SOAPHeaderElement(javax.xml.soap.SOAPHeaderElement) SOAPBody(javax.xml.soap.SOAPBody) WebServiceException(javax.xml.ws.WebServiceException) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) SOAPMessage(javax.xml.soap.SOAPMessage) SOAPHeader(javax.xml.soap.SOAPHeader) SOAPFactory(javax.xml.soap.SOAPFactory) Name(javax.xml.soap.Name) SOAPBodyElement(javax.xml.soap.SOAPBodyElement)

Example 92 with SOAPException

use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.

the class PortHandler method appendHandlerName.

private boolean appendHandlerName(SOAPMessageContext msgContext, String direction) {
    try {
        SOAPMessage soapMessage = msgContext.getMessage();
        SOAPElement soapElement = getFirstChildElement(soapMessage.getSOAPBody());
        soapElement = getFirstChildElement(soapElement);
        String oldValue = soapElement.getValue();
        String newValue = oldValue + ":" + direction + ":PortHandler";
        soapElement.setValue(newValue);
        log.debug("oldValue: " + oldValue);
        log.debug("newValue: " + newValue);
        return true;
    } catch (SOAPException ex) {
        throw new WebServiceException(ex);
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 93 with SOAPException

use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.

the class ProtocolHandler method appendHandlerName.

private boolean appendHandlerName(SOAPMessageContext msgContext, String direction) {
    try {
        SOAPMessage soapMessage = msgContext.getMessage();
        SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
        soapElement = (SOAPElement) soapElement.getChildElements().next();
        String oldValue = soapElement.getValue();
        String newValue = oldValue + ":" + direction + ":ProtocolHandler";
        soapElement.setValue(newValue);
        log.debug("oldValue: " + oldValue);
        log.debug("newValue: " + newValue);
        return true;
    } catch (SOAPException ex) {
        throw new WebServiceException(ex);
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 94 with SOAPException

use of javax.xml.soap.SOAPException 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();
        SOAPBody soapBody = soapMessage.getSOAPBody();
        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;
}
Also used : SOAPBody(javax.xml.soap.SOAPBody) WebServiceException(javax.xml.ws.WebServiceException) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) SOAPMessage(javax.xml.soap.SOAPMessage) SOAPBodyElement(javax.xml.soap.SOAPBodyElement)

Example 95 with SOAPException

use of javax.xml.soap.SOAPException in project jbossws-cxf by jbossws.

the class LogHandler method handleInbound.

@Override
protected boolean handleInbound(SOAPMessageContext msgContext) {
    log.info("handleInbound");
    try {
        SOAPMessage soapMessage = msgContext.getMessage();
        SOAPBody soapBody = soapMessage.getSOAPBody();
        SOAPBodyElement soapBodyElement = (SOAPBodyElement) soapBody.getChildElements().next();
        SOAPElement soapElement = (SOAPElement) soapBodyElement.getChildElements().next();
        String value = soapElement.getValue();
        soapElement.setValue(value + "|LogIn");
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
    return true;
}
Also used : SOAPBody(javax.xml.soap.SOAPBody) WebServiceException(javax.xml.ws.WebServiceException) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) SOAPMessage(javax.xml.soap.SOAPMessage) SOAPBodyElement(javax.xml.soap.SOAPBodyElement)

Aggregations

SOAPException (javax.xml.soap.SOAPException)225 SOAPMessage (javax.xml.soap.SOAPMessage)135 SOAPElement (javax.xml.soap.SOAPElement)71 SOAPBody (javax.xml.soap.SOAPBody)62 WebServiceException (javax.xml.ws.WebServiceException)57 IOException (java.io.IOException)53 Element (org.w3c.dom.Element)36 QName (javax.xml.namespace.QName)33 SOAPBodyElement (javax.xml.soap.SOAPBodyElement)33 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)28 SOAPFault (javax.xml.soap.SOAPFault)27 SOAPEnvelope (javax.xml.soap.SOAPEnvelope)25 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)24 Node (org.w3c.dom.Node)23 SOAPFactory (javax.xml.soap.SOAPFactory)22 SOAPMessageContext (javax.xml.ws.handler.soap.SOAPMessageContext)20 SOAPHeader (javax.xml.soap.SOAPHeader)19 SOAPPart (javax.xml.soap.SOAPPart)19 Iterator (java.util.Iterator)17 Fault (org.apache.cxf.interceptor.Fault)16