Search in sources :

Example 71 with SOAPException

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

the class SOAP11ClientHandler method handleInbound.

@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
    log.info("handleInbound");
    try {
        SOAPEnvelope soapEnvelope = msgContext.getMessage().getSOAPPart().getEnvelope();
        String nsURI = soapEnvelope.getNamespaceURI();
        log.info("nsURI=" + nsURI);
        if (!SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(nsURI)) {
            return false;
        }
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
    ContentType contentType = getContentType(msgContext);
    if (contentType != null) {
        log.info("contentType=" + contentType);
        String startInfo = contentType.getParameter("start-info");
        if (!startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE)) {
            return false;
        }
    } else {
        return false;
    }
    return true;
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) ContentType(javax.mail.internet.ContentType) SOAPException(javax.xml.soap.SOAPException) SOAPEnvelope(javax.xml.soap.SOAPEnvelope)

Example 72 with SOAPException

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

the class SOAP11ServerHandler method handleInbound.

@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
    log.info("handleInbound");
    ContentType contentType = getContentType(msgContext);
    if (contentType != null) {
        log.info("contentType=" + contentType);
        String startInfo = contentType.getParameter("start-info");
        if (!startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE)) {
            return false;
        }
    } else {
        return false;
    }
    try {
        SOAPEnvelope soapEnvelope = ((SOAPMessageContext) msgContext).getMessage().getSOAPPart().getEnvelope();
        String nsURI = soapEnvelope.getNamespaceURI();
        log.info("nsURI=" + nsURI);
        if (!SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(nsURI)) {
            return false;
        }
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
    return true;
}
Also used : ContentType(javax.mail.internet.ContentType) WebServiceException(javax.xml.ws.WebServiceException) SOAPMessageContext(javax.xml.ws.handler.soap.SOAPMessageContext) SOAPException(javax.xml.soap.SOAPException) SOAPEnvelope(javax.xml.soap.SOAPEnvelope)

Example 73 with SOAPException

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

the class SOAP12ClientHandler method handleInbound.

@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
    log.info("handleInbound");
    try {
        SOAPEnvelope soapEnvelope = msgContext.getMessage().getSOAPPart().getEnvelope();
        String nsURI = soapEnvelope.getNamespaceURI();
        log.info("nsURI=" + nsURI);
        if (!SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(nsURI)) {
            return false;
        }
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
    ContentType contentType = getContentType(msgContext);
    if (contentType != null) {
        log.info("contentType=" + contentType);
        String startInfo = contentType.getParameter("start-info");
        if (!startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE)) {
            return false;
        }
    } else {
        return false;
    }
    return true;
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) ContentType(javax.mail.internet.ContentType) SOAPException(javax.xml.soap.SOAPException) SOAPEnvelope(javax.xml.soap.SOAPEnvelope)

Example 74 with SOAPException

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

the class ClientHandler method handleInbound.

public boolean handleInbound(SOAPMessageContext msgContext) {
    log.info("handleInbound");
    try {
        SOAPEnvelope soapEnvelope = (SOAPEnvelope) msgContext.getMessage().getSOAPPart().getEnvelope();
        String nsURI = soapEnvelope.getNamespaceURI();
        log.info("nsURI=" + nsURI);
        if (!SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(nsURI)) {
            throw new RuntimeException("Wrong NS uri: " + nsURI);
        }
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
    ContentType contentType = getContentType(msgContext);
    if (contentType != null) {
        log.info("contentType=" + contentType);
        String startInfo = contentType.getParameter("start-info");
        if (!checkMtom) {
            if (startInfo != null) {
                throw new RuntimeException("Unexpected multipart/related message!");
            } else {
                return true;
            }
        }
        if (!startInfo.equals(SOAPConstants.SOAP_1_1_CONTENT_TYPE)) {
            throw new RuntimeException("Wrong start info: " + startInfo);
        }
    } else {
        throw new RuntimeException("Missing content type");
    }
    return true;
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) ContentType(javax.mail.internet.ContentType) SOAPException(javax.xml.soap.SOAPException) SOAPEnvelope(javax.xml.soap.SOAPEnvelope)

Example 75 with SOAPException

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

the class ProtocolHandler method appendHandlerName.

private boolean appendHandlerName(MessageContext msgContext) {
    try {
        SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
        SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
        soapElement = (SOAPElement) soapElement.getChildElements().next();
        String value = soapElement.getValue();
        String handlerName = getHandlerName();
        soapElement.setValue(value + ":" + handlerName);
        return true;
    } catch (SOAPException ex) {
        throw new WebServiceException(ex);
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) SOAPMessageContext(javax.xml.ws.handler.soap.SOAPMessageContext) SOAPException(javax.xml.soap.SOAPException) SOAPElement(javax.xml.soap.SOAPElement) SOAPMessage(javax.xml.soap.SOAPMessage)

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