use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestSerialization method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
SOAPFault fault = soapFactory.createSOAPFault(body);
SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(fault);
OMNamespace omNamespace = soapFactory.createOMNamespace("http://www.test.org", "test");
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry1", omNamespace));
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry2", omNamespace));
StringWriter out = new StringWriter();
soapFaultDetail.serialize(out);
String msg = out.toString();
assertTrue(msg.indexOf("DetailEntry1") != -1);
assertTrue(msg.indexOf("DetailEntry2") != -1);
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestCloneWithSourcedElement2 method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope sourceEnv = soapFactory.getDefaultEnvelope();
SOAPBody body = sourceEnv.getBody();
SOAPHeader header = sourceEnv.getHeader();
// Create a header OMSE
OMDataSource dsHdr = new StringOMDataSource("<hdr:myheader xmlns:hdr=\"urn://test\">Hello World</hdr:myheader>");
OMNamespace hdrNS = header.getOMFactory().createOMNamespace("urn://test", "hdr");
SOAPFactory sf = (SOAPFactory) header.getOMFactory();
SOAPHeaderBlock shb = sf.createSOAPHeaderBlock("myheader", hdrNS, dsHdr);
// test setting processing flag
shb.setProcessed();
header.addChild(shb);
// Create a payload
OMDataSource ds = new StringOMDataSource("<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>");
OMNamespace ns = body.getOMFactory().createOMNamespace("urn://test", "tns");
OMSourcedElement omse = body.getOMFactory().createOMElement(ds, "payload", ns);
body.addChild(omse);
copyAndCheck(sourceEnv);
// The source SOAPHeaderBlock should not be expanded in the process
assertFalse(shb.isExpanded());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetBody method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
SOAPBody body = envelope.getBody();
assertEquals("Body Test : - Body local name mismatch", SOAPConstants.BODY_LOCAL_NAME, body.getLocalName());
assertEquals("Body Test : - Body namespace mismatch", spec.getEnvelopeNamespaceURI(), body.getNamespace().getNamespaceURI());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetHeader method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
SOAPHeader header = envelope.getHeader();
assertEquals("Header Test : - Header local name mismatch", SOAPConstants.HEADER_LOCAL_NAME, header.getLocalName());
assertEquals("Header Test : - Header namespace mismatch", spec.getEnvelopeNamespaceURI(), header.getNamespace().getNamespaceURI());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetOrCreateHeader method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
SOAPHeader header = (SOAPHeader) envelope.getFirstOMChild();
assertSame(header, envelope.getOrCreateHeader());
}
Aggregations