Search in sources :

Example 1 with AxiomSoapMessage

use of org.springframework.ws.soap.axiom.AxiomSoapMessage in project webservices-axiom by apache.

the class AxiomSoapMessageFactoryTest method testCreateWebServiceMessage.

/**
     * Regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-444">AXIOM-444</a>.
     * 
     * @throws Exception
     */
public void testCreateWebServiceMessage() throws Exception {
    AxiomSoapMessageFactory mf = new AxiomSoapMessageFactory();
    mf.afterPropertiesSet();
    AxiomSoapMessage swsMessage = mf.createWebServiceMessage();
    SOAPMessage message = swsMessage.getAxiomMessage();
    // Spring-WS uses SOAPFactory#createSOAPMessage(OMXMLParserWrapper) with a null argument.
    // We need to make sure that we nevertheless get a SOAPMessage that is in state complete.
    assertTrue(message.isComplete());
}
Also used : AxiomSoapMessageFactory(org.springframework.ws.soap.axiom.AxiomSoapMessageFactory) AxiomSoapMessage(org.springframework.ws.soap.axiom.AxiomSoapMessage) SOAPMessage(org.apache.axiom.soap.SOAPMessage)

Example 2 with AxiomSoapMessage

use of org.springframework.ws.soap.axiom.AxiomSoapMessage in project webservices-axiom by apache.

the class AxiomSoapMessageTest method testSetDocument.

/**
     * Tests that {@link AxiomSoapMessage#setDocument(Document)} works correctly. There have been
     * issues with that method because Spring-WS instantiates {@link SOAPFactory} implementations
     * directly instead of using {@link OMAbstractFactory}.
     * 
     * @throws Exception
     */
public void testSetDocument() throws Exception {
    AxiomSoapMessageFactory mf = new AxiomSoapMessageFactory();
    mf.afterPropertiesSet();
    AxiomSoapMessage message = mf.createWebServiceMessage();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    Document document = dbf.newDocumentBuilder().parse(AxiomSoapMessageTest.class.getResource("soap-message.xml").toString());
    message.setDocument(document);
    Iterator<SoapHeaderElement> it = message.getEnvelope().getHeader().examineAllHeaderElements();
    assertTrue(it.hasNext());
    SoapHeaderElement headerElement = it.next();
    assertEquals(new QName("urn:test", "myHeader"), headerElement.getName());
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) SoapHeaderElement(org.springframework.ws.soap.SoapHeaderElement) AxiomSoapMessageFactory(org.springframework.ws.soap.axiom.AxiomSoapMessageFactory) QName(javax.xml.namespace.QName) Document(org.w3c.dom.Document) AxiomSoapMessage(org.springframework.ws.soap.axiom.AxiomSoapMessage)

Aggregations

AxiomSoapMessage (org.springframework.ws.soap.axiom.AxiomSoapMessage)2 AxiomSoapMessageFactory (org.springframework.ws.soap.axiom.AxiomSoapMessageFactory)2 QName (javax.xml.namespace.QName)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 SOAPMessage (org.apache.axiom.soap.SOAPMessage)1 SoapHeaderElement (org.springframework.ws.soap.SoapHeaderElement)1 Document (org.w3c.dom.Document)1