use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestCommentInEpilog method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new StringReader(soapFactory.getDefaultEnvelope() + "<!--comment-->")).getSOAPEnvelope();
OMNode sibling = envelope.getNextOMSibling();
assertTrue(sibling instanceof OMComment);
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetFault method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
assertNull("Body Test:- After creating a soap body it has a fault", body.getFault());
body.addFault(new Exception("This an exception for testing"));
assertNotNull("Body Test:- After calling addFault method, getFault method returns null", body.getFault());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetFirstElementLocalNameEmptyBody method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
assertNull(envelope.getBody().getFirstElementLocalName());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetFirstElementLocalNameWithParserNoLookahead method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope orgEnvelope = soapFactory.getDefaultEnvelope();
OMElement payload = soapFactory.createOMElement("payload", soapFactory.createOMNamespace("urn:test", "p"), orgEnvelope.getBody());
OMElement child = soapFactory.createOMElement("child", null, payload);
soapFactory.createOMElement("grandchild", null, child);
SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new StringReader(orgEnvelope.toString()));
SOAPBody body = builder.getSOAPEnvelope().getBody();
body.getFirstElement().getFirstElement();
assertThat(body.getFirstElementLocalName()).isEqualTo("payload");
}
use of org.apache.axiom.soap.SOAPEnvelope in project wso2-axis2-transports by wso2.
the class PlainTextFormatterTest method createMessageContext.
private MessageContext createMessageContext(String textPayload) throws AxisFault {
MessageContext messageContext = new MessageContext();
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope envelope = factory.getDefaultEnvelope();
OMElement textWrapper = factory.createOMElement(BaseConstants.DEFAULT_TEXT_WRAPPER);
textWrapper.setText(textPayload);
envelope.getBody().addChild(textWrapper);
messageContext.setEnvelope(envelope);
return messageContext;
}
Aggregations