Java Code Examples for javax.xml.soap.SOAPMessage

The following examples show how to use javax.xml.soap.SOAPMessage. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: cxf   Source File: SOAPHandlerFaultInInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) {
    if (binding.getHandlerChain().isEmpty()) {
        return;
    }
    if (getInvoker(message).getProtocolHandlers().isEmpty()) {
        return;
    }

    checkUnderstoodHeaders(message);
    MessageContext context = createProtocolMessageContext(message);
    HandlerChainInvoker invoker = getInvoker(message);
    invoker.setProtocolMessageContext(context);

    if (!invoker.invokeProtocolHandlersHandleFault(isRequestor(message), context)) {
        handleAbort(message, context);
    }

    SOAPMessage msg = message.getContent(SOAPMessage.class);
    if (msg != null) {
        XMLStreamReader xmlReader = createXMLStreamReaderFromSOAPMessage(msg);
        message.setContent(XMLStreamReader.class, xmlReader);
    }

}
 
Example 2
Source Project: cxf   Source File: GreeterDOMSourcePayloadProvider.java    License: Apache License 2.0 6 votes vote down vote up
public DOMSource invoke(DOMSource request) {
    DOMSource response = new DOMSource();
    try {
        System.out.println("Incoming Client Request as a DOMSource data in PAYLOAD Mode");
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
        Transformer transformer = transformerFactory.newTransformer();
        StreamResult result = new StreamResult(System.out);
        transformer.transform(request, result);
        System.out.println("\n");

        SOAPMessage greetMeResponse = null;
        try (InputStream is = getClass().getResourceAsStream("/GreetMeDocLiteralResp3.xml")) {
            greetMeResponse = MessageFactory.newInstance().createMessage(null, is);
        }
        response.setNode(greetMeResponse.getSOAPBody().extractContentAsDocument());
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return response;
}
 
Example 3
private void getMessageID(SOAPMessage msg) throws SOAPException {
   SOAPHeader header = msg.getSOAPHeader();
   if (header != null && header.getChildElements().hasNext()) {
      Node elementsResponseHeader = (Node)header.getChildElements().next();
      NodeList elementsheader = elementsResponseHeader.getChildNodes();

      for(int i = 0; i < elementsheader.getLength(); ++i) {
         org.w3c.dom.Node element = elementsheader.item(i);
         if (element.getLocalName() != null && element.getLocalName().equals("MessageID")) {
            LOG.info("The message id of the response: " + element.getNodeValue());
            break;
         }
      }
   }

}
 
Example 4
public boolean handleOutbound(SOAPMessageContext context) {
   this.setHandler();
   SOAPMessage msg = context.getMessage();

   try {
      JsonObject request = new JsonObject();
      request.addProperty("method", "POST");
      request.addProperty("url", context.get("javax.xml.ws.service.endpoint.address").toString());
      request.addProperty("httpVersion", "HTTP/1.1");
      request.add("headers", this.handleHeaders(msg.getMimeHeaders()));
      request.add("queryString", new JsonArray());
      request.add("cookies", new JsonArray());
      request.addProperty("headersSize", Integer.valueOf(-1));
      request.add("postData", this.getPostData(msg));
      request.addProperty("time", "1");
      request.addProperty("bodySize", Integer.valueOf(-1));
      this.split = System.currentTimeMillis();
      this.getEntry().get("timings").getAsJsonObject().addProperty("send", this.split.longValue() - this.start.longValue());
      this.getEntry().add("request", request);
   } catch (Exception var4) {
      LOG.error(var4.getMessage(), var4);
   }

   return true;
}
 
Example 5
Source Project: jdk8u60   Source File: StreamHeader.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void writeTo(SOAPMessage saaj) throws SOAPException {
    try {
        // TODO what about in-scope namespaces
        // Not very efficient consider implementing a stream buffer
        // processor that produces a DOM node from the buffer.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 6
Source Project: openjdk-jdk8u   Source File: StreamHeader.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void writeTo(SOAPMessage saaj) throws SOAPException {
    try {
        // TODO what about in-scope namespaces
        // Not very efficient consider implementing a stream buffer
        // processor that produces a DOM node from the buffer.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 7
Source Project: keycloak   Source File: Soap.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <p>Returns a string encoded accordingly with the SAML HTTP POST Binding specification based on the
 * given <code>inputStream</code> which must contain a valid SOAP message.
 *
 * <p>The resulting string is based on the Body of the SOAP message, which should map to a valid SAML message.
 *
 * @param inputStream the input stream containing a valid SOAP message with a Body that contains a SAML message
 *
 * @return a string encoded accordingly with the SAML HTTP POST Binding specification
 */
public static String toSamlHttpPostMessage(InputStream inputStream) {
    try {
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage soapMessage = messageFactory.createMessage(null, inputStream);
        SOAPBody soapBody = soapMessage.getSOAPBody();
        Node authnRequestNode = soapBody.getFirstChild();
        Document document = DocumentUtil.createDocument();

        document.appendChild(document.importNode(authnRequestNode, true));

        return PostBindingUtil.base64Encode(DocumentUtil.asString(document));
    } catch (Exception e) {
        throw new RuntimeException("Error creating fault message.", e);
    }
}
 
Example 8
@Test
public void testAddElementToGlobalNsQName() throws Exception {
    // Create empty SOAP message
    SOAPMessage msg = createSoapMessage();
    SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();

    // Add elements
    SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
    parentExplicitNS.addNamespaceDeclaration("", TEST_NS);
    SOAPElement childGlobalNS = parentExplicitNS.addChildElement(new QName("", "global-child"));
    childGlobalNS.addNamespaceDeclaration("", "");
    SOAPElement grandChildGlobalNS = childGlobalNS.addChildElement("global-grand-child");
    SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");

    // Check namespace URIs
    Assert.assertNull(childGlobalNS.getNamespaceURI());
    Assert.assertNull(grandChildGlobalNS.getNamespaceURI());
    Assert.assertEquals(childDefaultNS.getNamespaceURI(),TEST_NS);
}
 
Example 9
Source Project: hottub   Source File: Stubs.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portInfo
 *      see <a href="#param">common parameters</a>
 * @param owner
 *      see <a href="#param">common parameters</a>
 * @param binding
 *      see <a href="#param">common parameters</a>
 * @param clazz
 *      Type of the {@link Dispatch} to be created.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param mode
 *      The mode of the dispatch.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param epr
 *      see <a href="#param">common parameters</a>
 * TODO: are these parameters making sense?
 */
public static <T> Dispatch<T> createDispatch(WSPortInfo portInfo,
                                             WSService owner,
                                             WSBinding binding,
                                             Class<T> clazz, Service.Mode mode,
                                             @Nullable WSEndpointReference epr) {
    if (clazz == SOAPMessage.class) {
        return (Dispatch<T>) createSAAJDispatch(portInfo, binding, mode, epr);
    } else if (clazz == Source.class) {
        return (Dispatch<T>) createSourceDispatch(portInfo, binding, mode, epr);
    } else if (clazz == DataSource.class) {
        return (Dispatch<T>) createDataSourceDispatch(portInfo, binding, mode, epr);
    } else if (clazz == Message.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createMessageDispatch(portInfo, binding, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Message>");
    } else if (clazz == Packet.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createPacketDispatch(portInfo, binding, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Packet>");
    } else
        throw new WebServiceException("Unknown class type " + clazz.getName());
}
 
Example 10
Source Project: openjdk-jdk9   Source File: XmlTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
private SOAPMessage createMessage(MessageFactory mf) throws SOAPException, IOException {
    SOAPMessage msg = mf.createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    Name name = envelope.createName("hello", "ex", "http://example.com");
    envelope.getBody().addChildElement(name).addTextNode("THERE!");

    String s = "<root><hello>THERE!</hello></root>";

    AttachmentPart ap = msg.createAttachmentPart(
            new StreamSource(new ByteArrayInputStream(s.getBytes())),
            "text/xml"
    );
    msg.addAttachmentPart(ap);
    msg.saveChanges();

    return msg;
}
 
Example 11
@Override
public SOAPMessage readAsSOAPMessage() throws SOAPException {
    if (!(delegate instanceof SAAJMessage)) {
        delegate = toSAAJ(packet, null);
    }
    return delegate.readAsSOAPMessage();
}
 
Example 12
Source Project: cxf   Source File: SOAPHandlerInterceptor.java    License: Apache License 2.0 5 votes vote down vote up
private XMLStreamReader createXMLStreamReaderFromSOAPMessage(SOAPMessage soapMessage) {
    // responseMsg.setContent(SOAPMessage.class, soapMessage);
    XMLStreamReader xmlReader = null;
    try {
        DOMSource bodySource = new DOMSource(soapMessage.getSOAPPart().getEnvelope().getBody());
        xmlReader = StaxUtils.createXMLStreamReader(bodySource);
        xmlReader.nextTag();
        xmlReader.nextTag(); // move past body tag
    } catch (SOAPException | XMLStreamException e) {
        e.printStackTrace();
    }
    return xmlReader;
}
 
Example 13
public SOAPMessage getParameter(Packet packet) {
    try {
        return packet.getMessage().readAsSOAPMessage(packet, true);
    } catch (SOAPException se) {
        throw new WebServiceException(se);
    }
}
 
Example 14
public void setMessage(SOAPMessage soapMsg) {
    try {
        this.soapMsg = soapMsg;
    } catch(Exception e) {
        throw new WebServiceException(e);
    }
}
 
Example 15
Source Project: hottub   Source File: StringHeader.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(SOAPMessage saaj) throws SOAPException {
    SOAPHeader header = saaj.getSOAPHeader();
    if(header == null)
        header = saaj.getSOAPPart().getEnvelope().addHeader();
    SOAPHeaderElement she = header.addHeaderElement(name);
    if(mustUnderstand) {
        she.setMustUnderstand(true);
    }
    she.addTextNode(value);
}
 
Example 16
@Override
public SOAPMessage readAsSOAPMessage(Packet p, boolean inbound) throws SOAPException {
    if (!(delegate instanceof SAAJMessage)) {
        delegate = toSAAJ(p, inbound);
    }
    return delegate.readAsSOAPMessage();
}
 
Example 17
Source Project: mdw   Source File: MdwRpcWebServiceAdapter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Unwrap the SOAP response into a DOM Node.
 */
protected Node unwrapSoapResponse(SOAPMessage soapResponse) throws ActivityException, AdapterException {
    try {
        // unwrap the soap content from the message
        SOAPBody soapBody = soapResponse.getSOAPBody();
        Node childElem = null;
        Iterator<?> it = soapBody.getChildElements();
        while (it.hasNext()) {
            Node node = (Node) it.next();
            if (node.getNodeType() == Node.ELEMENT_NODE && node.getLocalName().equals(getOutputMessageName())) {
                NodeList childNodes = node.getChildNodes();
                for (int i = 0; i < childNodes.getLength(); i++) {
                    if (getResponsePartName().equals(childNodes.item(i).getLocalName())) {
                        String content = childNodes.item(i).getTextContent();
                        childElem = DomHelper.toDomNode(content);
                    }
                }
            }
        }
        if (childElem == null)
          throw new SOAPException("SOAP body child element not found");

        // extract soap response headers
        SOAPHeader header = soapResponse.getSOAPHeader();
        if (header != null) {
            extractSoapResponseHeaders(header);
        }

        return childElem;
    }
    catch (Exception ex) {
        throw new ActivityException(ex.getMessage(), ex);
    }
}
 
Example 18
@Test
public void testResetDefaultNamespaceSAAJ() throws Exception {
    // Create SOAP message from XML string and process it with SAAJ reader
    XMLStreamReader envelope = XMLInputFactory.newFactory().createXMLStreamReader(
            new StringReader(INPUT_SOAP_MESSAGE));
    StreamMessage streamMessage = new StreamMessage(SOAPVersion.SOAP_11,
            envelope, null);
    SAAJFactory saajFact = new SAAJFactory();
    SOAPMessage soapMessage = saajFact.readAsSOAPMessage(SOAPVersion.SOAP_11, streamMessage);

    // Check if constructed object model meets local names and namespace expectations
    SOAPElement request = (SOAPElement) soapMessage.getSOAPBody().getFirstChild();
    // Check top body element name
    Assert.assertEquals(request.getLocalName(), "SampleServiceRequest");
    // Check top body element namespace
    Assert.assertEquals(request.getNamespaceURI(), TEST_NS);
    SOAPElement params = (SOAPElement) request.getFirstChild();
    // Check first child name
    Assert.assertEquals(params.getLocalName(), "RequestParams");
    // Check if first child namespace is null
    Assert.assertNull(params.getNamespaceURI());

    // Check inner elements of the first child
    SOAPElement param1 = (SOAPElement) params.getFirstChild();
    Assert.assertEquals(param1.getLocalName(), "Param1");
    Assert.assertNull(param1.getNamespaceURI());
    SOAPElement param2 = (SOAPElement) params.getChildNodes().item(1);
    Assert.assertEquals(param2.getLocalName(), "Param2");
    Assert.assertNull(param2.getNamespaceURI());
    // Check full content of SOAP body
    Assert.assertEquals(nodeToText(request), EXPECTED_RESULT);
}
 
Example 19
Source Project: openjdk-8   Source File: JAXBAttachment.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeTo(SOAPMessage saaj) throws SOAPException {
    AttachmentPart part = saaj.createAttachmentPart();
    part.setDataHandler(asDataHandler());
    part.setContentId(contentId);
    saaj.addAttachmentPart(part);
}
 
Example 20
Source Project: jdk8u60   Source File: JAXBAttachment.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeTo(SOAPMessage saaj) throws SOAPException {
    AttachmentPart part = saaj.createAttachmentPart();
    part.setDataHandler(asDataHandler());
    part.setContentId(contentId);
    saaj.addAttachmentPart(part);
}
 
Example 21
Source Project: cxf   Source File: DispatchClientServerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSOAPMessageInvokeToOneWay() throws Exception {
    SOAPService service = new SOAPService(null, SERVICE_NAME);
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
                    "http://localhost:" + greeterPort
                    + "/SOAPDispatchService/SoapDispatchPort");
    assertNotNull(service);

    Dispatch<SOAPMessage> disp = service
        .createDispatch(PORT_NAME, SOAPMessage.class, Service.Mode.MESSAGE);

    //message is "one way", but there really isn't a way for us to know that
    //as we don't have a wsdl or other source of operation information to
    //compare the payload to.
    InputStream is1 = getClass().getResourceAsStream("resources/GreetMe1WDocLiteralReq2.xml");
    SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1);
    assertNotNull(soapReqMsg1);

    //Version 1:
    //we'll just call invoke
    disp.invoke(soapReqMsg1);

    //Version 2:
    //We want to handle things asynchronously
    AsyncHandler<SOAPMessage> callback = new AsyncHandler<SOAPMessage>() {
        public void handleResponse(Response<SOAPMessage> res) {
            synchronized (this) {
                notifyAll();
            }
        }
    };
    synchronized (callback) {
        disp.invokeAsync(soapReqMsg1, callback);
        callback.wait();
    }
}
 
Example 22
Source Project: jdk8u60   Source File: SAAJFactory.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates Message from SOAPMessage
 * @param saaj SOAPMessage
 * @return created Message
 */
public static Message create(SOAPMessage saaj) {
        for (SAAJFactory s : ServiceFinder.find(SAAJFactory.class)) {
                Message m = s.createMessage(saaj);
                if (m != null)
                        return m;
        }

return instance.createMessage(saaj);
}
 
Example 23
Source Project: jdk8u60   Source File: SAAJFactory.java    License: GNU General Public License v2.0 5 votes vote down vote up
static protected void addAttachmentsToSOAPMessage(SOAPMessage msg, Message message) {
    for(Attachment att : message.getAttachments()) {
        AttachmentPart part = msg.createAttachmentPart();
        part.setDataHandler(att.asDataHandler());

        // Be safe and avoid double angle-brackets.
        String cid = att.getContentId();
        if (cid != null) {
            if (cid.startsWith("<") && cid.endsWith(">"))
                part.setContentId(cid);
            else
                part.setContentId('<' + cid + '>');
        }

        // Add any MIME headers beside Content-ID, which is already
        // accounted for above, and Content-Type, which is provided
        // by the DataHandler above.
        if (att instanceof AttachmentEx) {
            AttachmentEx ax = (AttachmentEx) att;
            Iterator<AttachmentEx.MimeHeader> imh = ax.getMimeHeaders();
            while (imh.hasNext()) {
                AttachmentEx.MimeHeader ame = imh.next();
                if ((!"Content-ID".equals(ame.getName()))
                        && (!"Content-Type".equals(ame.getName())))
                    part.addMimeHeader(ame.getName(), ame.getValue());
            }
        }
        msg.addAttachmentPart(part);
    }
}
 
Example 24
public void writeTo(SOAPMessage saaj) throws SOAPException {
    SOAPHeader header = saaj.getSOAPHeader();
    if (header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
    SOAPHeaderElement she = header.addHeaderElement(av.faultDetailTag);
    she = header.addHeaderElement(new QName(av.nsUri, wrapper));
    she.addTextNode(problemValue);
}
 
Example 25
static protected void addAttachmentsToSOAPMessage(SOAPMessage msg, Message message) {
    for(Attachment att : message.getAttachments()) {
        AttachmentPart part = msg.createAttachmentPart();
        part.setDataHandler(att.asDataHandler());

        // Be safe and avoid double angle-brackets.
        String cid = att.getContentId();
        if (cid != null) {
            if (cid.startsWith("<") && cid.endsWith(">"))
                part.setContentId(cid);
            else
                part.setContentId('<' + cid + '>');
        }

        // Add any MIME headers beside Content-ID, which is already
        // accounted for above, and Content-Type, which is provided
        // by the DataHandler above.
        if (att instanceof AttachmentEx) {
            AttachmentEx ax = (AttachmentEx) att;
            Iterator<AttachmentEx.MimeHeader> imh = ax.getMimeHeaders();
            while (imh.hasNext()) {
                AttachmentEx.MimeHeader ame = imh.next();
                if ((!"Content-ID".equals(ame.getName()))
                        && (!"Content-Type".equals(ame.getName())))
                    part.addMimeHeader(ame.getName(), ame.getValue());
            }
        }
        msg.addAttachmentPart(part);
    }
}
 
Example 26
public void writeTo(SOAPMessage saaj) throws SOAPException {
    SOAPHeader header = saaj.getSOAPHeader();
    if(header == null)
        header = saaj.getSOAPPart().getEnvelope().addHeader();
    SOAPHeaderElement she = header.addHeaderElement(new QName(getNamespaceURI(), getLocalPart()));
    she.addChildElement(actionLocalName);
    she.addTextNode(action);
    if (soapAction != null) {
        she.addChildElement(soapActionLocalName);
        she.addTextNode(soapAction);
    }
}
 
Example 27
public boolean handleInbound(SOAPMessageContext context) {
   SOAPMessage message = context.getMessage();
   WSSecurityEngine secEngine = new WSSecurityEngine();
   RequestData requestData = new RequestData();
   requestData.setWssConfig(this.config);

   try {
      SOAPHeader header = message.getSOAPHeader();
      if (header != null) {
         NodeList list = header.getElementsByTagNameNS(WSSE.getNamespaceURI(), WSSE.getLocalPart());
         if (list != null) {
            LOG.debug("Verify WS Security Header");

            for(int j = 0; j < list.getLength(); ++j) {
               List<WSSecurityEngineResult> results = secEngine.processSecurityHeader((Element)list.item(j), requestData);
               Iterator i$ = results.iterator();

               while(i$.hasNext()) {
                  WSSecurityEngineResult result = (WSSecurityEngineResult)i$.next();
                  if (!(Boolean) result.get("validated-token")) {
                     StringBuffer sb = new StringBuffer();
                     sb.append("Unable to validate incoming soap message. Action [");
                     sb.append(result.get("action"));
                     sb.append("].");
                     throw new ProtocolException(sb.toString());
                  }
               }
            }
         }
      }

      return true;
   } catch (WSSecurityException var12) {
      throw new ProtocolException(var12);
   } catch (SOAPException var13) {
      throw new ProtocolException(var13);
   }
}
 
Example 28
public SOAPMessage getMessage() {
    if(soapMsg == null) {
        try {
            Message m = packet.getMessage();
            soapMsg = m != null ? m.readAsSOAPMessage() : null;
        } catch (SOAPException e) {
            throw new WebServiceException(e);
        }
    }
    return soapMsg;
}
 
Example 29
/**
 * Checks whether the request has an associated SOAPAction MIME header
 * and returns its value.
 * @param request the message to check
 * @return the value of any associated SOAPAction MIME header or null
 * if there is no such header.
 */
private String checkForSOAPActionHeader(SOAPMessage request) {
    MimeHeaders hdrs = request.getMimeHeaders();
    if (hdrs != null) {
        String[] saHdrs = hdrs.getHeader("SOAPAction");
        if (saHdrs != null && saHdrs.length > 0)
            return saHdrs[0];
    }
    return null;
}
 
Example 30
Source Project: TencentKona-8   Source File: MessageWrapper.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public SOAPMessage readAsSOAPMessage(Packet p, boolean inbound) throws SOAPException {
    if (!(delegate instanceof SAAJMessage)) {
        delegate = toSAAJ(p, inbound);
    }
    return delegate.readAsSOAPMessage();
}