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());
}
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());
}
Aggregations