Search in sources :

Example 51 with SOAPEnvelope

use of javax.xml.soap.SOAPEnvelope in project arctic-sea by 52North.

the class Soap11Encoder method addSchemaLocationForExceptionToSOAPMessage.

private void addSchemaLocationForExceptionToSOAPMessage(SOAPMessage soapResponseMessage) throws SOAPException {
    SOAPEnvelope envelope = soapResponseMessage.getSOAPPart().getEnvelope();
    envelope.addNamespaceDeclaration(W3CConstants.NS_XSI_PREFIX, W3CConstants.NS_XSI);
    StringBuilder schemaLocation = new StringBuilder();
    schemaLocation.append(envelope.getNamespaceURI());
    schemaLocation.append(" ");
    schemaLocation.append(envelope.getNamespaceURI());
    schemaLocation.append(" ");
    schemaLocation.append(N52XmlHelper.getSchemaLocationForOWS110Exception());
    envelope.addAttribute(N52XmlHelper.getSchemaLocationQNameWithPrefix(), schemaLocation.toString());
}
Also used : SOAPEnvelope(javax.xml.soap.SOAPEnvelope)

Example 52 with SOAPEnvelope

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

the class JBossWSClientAuthConfig method getAuthContextID.

@SuppressWarnings("rawtypes")
public String getAuthContextID(MessageInfo messageInfo) {
    SOAPMessage request = (SOAPMessage) messageInfo.getRequestMessage();
    if (request == null) {
        return null;
    }
    String authContext = null;
    MimeHeaders headers = request.getMimeHeaders();
    if (headers != null) {
        String[] soapActions = headers.getHeader("SOAPAction");
        if (soapActions != null && soapActions.length > 0) {
            authContext = soapActions[0];
            if (!StringUtils.isEmpty(authContext)) {
                return authContext;
            }
        }
    }
    SOAPPart soapMessage = request.getSOAPPart();
    if (soapMessage != null) {
        try {
            SOAPEnvelope envelope = soapMessage.getEnvelope();
            if (envelope != null) {
                SOAPBody body = envelope.getBody();
                if (body != null) {
                    Iterator it = body.getChildElements();
                    while (it.hasNext()) {
                        Object o = it.next();
                        if (o instanceof SOAPElement) {
                            QName name = ((SOAPElement) o).getElementQName();
                            return name.getLocalPart();
                        }
                    }
                }
            }
        } catch (SOAPException se) {
            // ignore;
            Logger.getLogger(JBossWSClientAuthConfig.class).trace(se);
        }
    }
    return null;
}
Also used : MimeHeaders(javax.xml.soap.MimeHeaders) SOAPBody(javax.xml.soap.SOAPBody) QName(javax.xml.namespace.QName) SOAPException(javax.xml.soap.SOAPException) SOAPPart(javax.xml.soap.SOAPPart) Iterator(java.util.Iterator) SOAPElement(javax.xml.soap.SOAPElement) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 53 with SOAPEnvelope

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

the class JBossWSServerAuthConfig method getAuthContextID.

@SuppressWarnings("rawtypes")
public String getAuthContextID(MessageInfo messageInfo) {
    SOAPMessage request = (SOAPMessage) messageInfo.getRequestMessage();
    if (request == null) {
        return null;
    }
    String authContext = null;
    MimeHeaders headers = request.getMimeHeaders();
    if (headers != null) {
        String[] soapActions = headers.getHeader("SOAPAction");
        if (soapActions != null && soapActions.length > 0) {
            authContext = soapActions[0];
            if (!StringUtils.isEmpty(authContext)) {
                return authContext;
            }
        }
    }
    SOAPPart soapMessage = request.getSOAPPart();
    if (soapMessage != null) {
        try {
            SOAPEnvelope envelope = soapMessage.getEnvelope();
            if (envelope != null) {
                SOAPBody body = envelope.getBody();
                if (body != null) {
                    Iterator it = body.getChildElements();
                    while (it.hasNext()) {
                        Object o = it.next();
                        if (o instanceof SOAPElement) {
                            QName name = ((SOAPElement) o).getElementQName();
                            return name.getLocalPart();
                        }
                    }
                }
            }
        } catch (SOAPException se) {
            // ignore;
            Logger.getLogger(JBossWSServerAuthConfig.class).trace(se);
        }
    }
    return null;
}
Also used : MimeHeaders(javax.xml.soap.MimeHeaders) SOAPBody(javax.xml.soap.SOAPBody) QName(javax.xml.namespace.QName) SOAPException(javax.xml.soap.SOAPException) SOAPPart(javax.xml.soap.SOAPPart) Iterator(java.util.Iterator) SOAPElement(javax.xml.soap.SOAPElement) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 54 with SOAPEnvelope

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

the class TestHandler method checkEnvelope.

private void checkEnvelope(SOAPMessage soapMessage) throws SOAPException {
    SOAPPart part = soapMessage.getSOAPPart();
    SOAPEnvelope envelope = part.getEnvelope();
    String namespace = envelope.getNamespaceURI();
    if (envelopeNamespace.equals(namespace) == false) {
        throw new RuntimeException("Expected '" + envelopeNamespace + "' namespace, actual '" + namespace + "'");
    }
}
Also used : SOAPPart(javax.xml.soap.SOAPPart) SOAPEnvelope(javax.xml.soap.SOAPEnvelope)

Example 55 with SOAPEnvelope

use of javax.xml.soap.SOAPEnvelope 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;
}
Also used : SOAPBody(javax.xml.soap.SOAPBody) WebServiceException(javax.xml.ws.WebServiceException) SOAPMessageContext(javax.xml.ws.handler.soap.SOAPMessageContext) SOAPException(javax.xml.soap.SOAPException) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) SOAPMessage(javax.xml.soap.SOAPMessage)

Aggregations

SOAPEnvelope (javax.xml.soap.SOAPEnvelope)62 SOAPMessage (javax.xml.soap.SOAPMessage)37 SOAPException (javax.xml.soap.SOAPException)32 SOAPPart (javax.xml.soap.SOAPPart)26 SOAPBody (javax.xml.soap.SOAPBody)25 SOAPElement (javax.xml.soap.SOAPElement)22 SOAPHeader (javax.xml.soap.SOAPHeader)17 SOAPHeaderElement (javax.xml.soap.SOAPHeaderElement)14 Name (javax.xml.soap.Name)13 Iterator (java.util.Iterator)12 QName (javax.xml.namespace.QName)12 WebServiceException (javax.xml.ws.WebServiceException)10 MessageFactory (javax.xml.soap.MessageFactory)8 ProtocolException (javax.xml.ws.ProtocolException)7 SOAPMessageContext (javax.xml.ws.handler.soap.SOAPMessageContext)6 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 Document (org.w3c.dom.Document)6 Detail (javax.xml.soap.Detail)5 SOAPConnection (javax.xml.soap.SOAPConnection)5 SOAPFault (javax.xml.soap.SOAPFault)5