Search in sources :

Example 36 with SOAPEnvelope

use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.

the class TestSerialize method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, message.getInputStream(), null).getSOAPEnvelope();
    expansionStrategy.apply(soapEnvelope);
    assertAbout(xml()).that(serializationStrategy.serialize(soapEnvelope).getInputSource()).ignoringRedundantNamespaceDeclarations().ignoringPrologAndEpilog().hasSameContentAs(message.getInputStream());
    soapEnvelope.close(false);
}
Also used : SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 37 with SOAPEnvelope

use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.

the class TestSerializeAndConsumeWithOMSEInBody method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
    SOAPBody body = soapFactory.createSOAPBody();
    envelope.addChild(body);
    OMNamespace ns = soapFactory.createOMNamespace("http://ns1", "d");
    OMElement payload = soapFactory.createOMElement(new DummySource(), "dummy", ns);
    // This line will cause NoSuchElementException
    payload.setNamespace(ns);
    body.addChild(payload);
    StringWriter writer = new StringWriter();
    envelope.serializeAndConsume(writer);
//        System.out.println(writer);
}
Also used : SOAPBody(org.apache.axiom.soap.SOAPBody) OMNamespace(org.apache.axiom.om.OMNamespace) StringWriter(java.io.StringWriter) OMElement(org.apache.axiom.om.OMElement) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 38 with SOAPEnvelope

use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.

the class TestHasFaultWithOMSEUnknownName method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
    SOAPBody body = envelope.getBody();
    OMSourcedElement element = soapFactory.createOMElement(new StringOMDataSource("<ns:root xmlns:ns='urn:ns'/>"));
    body.addChild(element);
    assertFalse(body.hasFault());
    assertFalse(element.isExpanded());
}
Also used : SOAPBody(org.apache.axiom.soap.SOAPBody) StringOMDataSource(org.apache.axiom.om.ds.StringOMDataSource) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) OMSourcedElement(org.apache.axiom.om.OMSourcedElement)

Example 39 with SOAPEnvelope

use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.

the class BadInputTest method runTest.

@Override
protected void runTest() throws Throwable {
    try {
        SOAPEnvelope soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, BadInputTest.class.getClassLoader().getResourceAsStream("badsoap/" + file), null).getSOAPEnvelope();
        OMTestUtils.walkThrough(soapEnvelope);
        fail("this must failed gracefully with SOAPProcessingException");
    } catch (SOAPProcessingException e) {
        return;
    }
}
Also used : SOAPProcessingException(org.apache.axiom.soap.SOAPProcessingException) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 40 with SOAPEnvelope

use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.

the class MessageTest method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope soapEnvelope = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, message.getInputStream(), null).getSOAPEnvelope();
    OMTestUtils.walkThrough(soapEnvelope);
    soapEnvelope.close(false);
}
Also used : SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Aggregations

SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)105 OMElement (org.apache.axiom.om.OMElement)32 SOAPBody (org.apache.axiom.soap.SOAPBody)24 OMNamespace (org.apache.axiom.om.OMNamespace)22 SOAPHeader (org.apache.axiom.soap.SOAPHeader)20 SOAPFactory (org.apache.axiom.soap.SOAPFactory)18 QName (javax.xml.namespace.QName)16 SOAPFault (org.apache.axiom.soap.SOAPFault)14 ByteArrayInputStream (java.io.ByteArrayInputStream)12 SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)12 OMNode (org.apache.axiom.om.OMNode)11 SOAPModelBuilder (org.apache.axiom.soap.SOAPModelBuilder)11 MessageContext (org.apache.axis2.context.MessageContext)10 SOAPFaultCode (org.apache.axiom.soap.SOAPFaultCode)8 InputStream (java.io.InputStream)7 XMLStreamException (javax.xml.stream.XMLStreamException)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 StringReader (java.io.StringReader)6 DataHandler (javax.activation.DataHandler)6 OMException (org.apache.axiom.om.OMException)6