Search in sources :

Example 96 with SOAPException

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

the class CustomHandler 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 + "|CustomIn");
    } 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 97 with SOAPException

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

the class CustomHandler 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 + "|CustomOut");
    } 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 98 with SOAPException

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

the class ClientHandler method handleInbound.

@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
    try {
        SOAPMessage soapMessage = msgContext.getMessage();
        SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
        String nsURI = soapEnvelope.getNamespaceURI();
        SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
        soapElement = (SOAPElement) soapElement.getChildElements().next();
        String value = soapElement.getValue();
        soapElement.setValue(value + ":" + nsURI);
        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) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 99 with SOAPException

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

the class ServerHandler method handleInbound.

@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
    try {
        SOAPMessage soapMessage = msgContext.getMessage();
        SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
        nsURI = soapEnvelope.getNamespaceURI();
        return true;
    } catch (SOAPException ex) {
        throw new WebServiceException(ex);
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) SOAPException(javax.xml.soap.SOAPException) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) SOAPMessage(javax.xml.soap.SOAPMessage)

Example 100 with SOAPException

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

the class SOAPConnectionImpl method get.

@Override
public SOAPMessage get(Object addressObject) throws SOAPException {
    checkClosed();
    String address = getAddress(addressObject);
    ConduitInitiator ci = getConduitInitiator(address);
    // create a new Message and Exchange
    EndpointInfo info = new EndpointInfo();
    info.setAddress(address);
    Message outMessage = new MessageImpl();
    Exchange exch = new ExchangeImpl();
    outMessage.setExchange(exch);
    // sent GET request
    try {
        // TODO verify bus
        final Conduit c = ci.getConduit(info, BusFactory.getThreadDefaultBus(false));
        if (c instanceof HTTPConduit) {
            ((HTTPConduit) c).getClient().setAutoRedirect(true);
        }
        outMessage.put(Message.HTTP_REQUEST_METHOD, "GET");
        c.prepare(outMessage);
        c.setMessageObserver(createMessageObserver(c));
        c.close(outMessage);
    } catch (Exception ex) {
        throw MESSAGES.getRequestCouldNotBeSent(ex);
    }
    // read SOAPMessage
    return readSoapMessage(exch);
}
Also used : Exchange(org.apache.cxf.message.Exchange) HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Message(org.apache.cxf.message.Message) SOAPMessage(javax.xml.soap.SOAPMessage) Conduit(org.apache.cxf.transport.Conduit) HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) ConduitInitiator(org.apache.cxf.transport.ConduitInitiator) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) SOAPException(javax.xml.soap.SOAPException) IOException(java.io.IOException)

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