use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestGetAllDetailEntries 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");
Iterator<OMElement> iterator = soapFaultDetail.getAllDetailEntries();
assertFalse("SOAP Fault Detail Test : - After creating SOAP11FaultDetail element, it has DetailEntries", iterator.hasNext());
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry", omNamespace));
iterator = soapFaultDetail.getAllDetailEntries();
OMElement detailEntry = iterator.next();
assertNotNull("SOAP Fault Detail Test : - After calling addDetailEntry method, getAllDetailEntries method returns empty iterator", detailEntry);
assertEquals("SOAP Fault Detail Test : - detailEntry local name mismatch", "DetailEntry", detailEntry.getLocalName());
assertEquals("SOAP Fault Detail Test : - detailEntry namespace uri mismatch", "http://www.test.org", detailEntry.getNamespace().getNamespaceURI());
assertFalse("SOAP Fault Detail Test : - After calling addDetailEntry method once, getAllDetailEntries method returns an iterator with two objects", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPBody 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.SOAPBody 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.SOAPBody 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.SOAPBody in project webservices-axiom by apache.
the class TestGetBodyWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
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());
}
Aggregations