use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestClone method runTest.
@Override
protected void runTest() throws Throwable {
SOAPMessage message = soapFactory.createSOAPMessage();
message.addChild(soapFactory.getDefaultEnvelope());
OMCloneOptions options = new OMCloneOptions();
options.setPreserveModel(preserveModel);
OMInformationItem clone = message.clone(options);
if (preserveModel) {
assertTrue(clone instanceof SOAPMessage);
} else {
assertTrue(clone instanceof OMDocument);
assertFalse(clone instanceof SOAPMessage);
}
OMElement envelope = ((OMDocument) clone).getOMDocumentElement();
if (preserveModel) {
assertTrue(envelope instanceof SOAPEnvelope);
} else {
assertFalse(envelope instanceof SOAPEnvelope);
}
assertEquals("Envelope", envelope.getLocalName());
assertEquals(spec.getEnvelopeNamespaceURI(), envelope.getNamespaceURI());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetCharsetEncodingWithParser method runTest.
@Override
protected void runTest() throws Throwable {
String encoding = "iso-8859-15";
SOAPEnvelope orgEnvelope = soapFactory.getDefaultEnvelope();
soapFactory.createOMElement("echo", soapFactory.createOMNamespace("urn:test", null)).setText("test");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OMOutputFormat format = new OMOutputFormat();
format.setCharSetEncoding(encoding);
orgEnvelope.serialize(baos, format);
SOAPMessage message = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new ByteArrayInputStream(baos.toByteArray()), encoding).getSOAPMessage();
assertEquals(encoding, message.getCharsetEncoding());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestExamineMustUnderstandHeaderBlocks method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope soapEnvelope = soapFactory.createSOAPEnvelope();
SOAPHeader soapHeader = soapFactory.createSOAPHeader(soapEnvelope);
OMNamespace namespace = soapFactory.createOMNamespace("http://www.example.org", "test");
soapHeader.addHeaderBlock("echoOk1", namespace).setRole("http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");
SOAPHeaderBlock headerBlock1 = soapHeader.addHeaderBlock("echoOk2", namespace);
headerBlock1.setRole("http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");
headerBlock1.setMustUnderstand(true);
soapHeader.addHeaderBlock("echoOk3", namespace).setMustUnderstand(true);
Iterator iterator = soapHeader.examineMustUnderstandHeaderBlocks("http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");
iterator.hasNext();
SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next();
assertFalse("SOAP Header Test : - examineMustUnderstandHeaderBlocks method returns empty iterator", headerBlock == null);
assertTrue("SOAP Header Test : - HeaderBlock local name mismatch", headerBlock.getLocalName().equals("echoOk2"));
assertTrue("SOAP Header Test : - HeaderBlock role value mismatch", headerBlock.getRole().equals("http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));
assertFalse("SOAP Header Test : - examineMustUnderstandHeaderBlocks method returns an iterator with more than one object", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetValue method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.getDefaultEnvelope();
SOAPFault fault = soapFactory.createSOAPFault(env.getBody());
SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
code.setText(new QName("urn:test", "test"));
assertNull(code.getValue());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestMoreChildrenAddition method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.getDefaultFaultEnvelope();
SOAPEnvelope soapEnvelope = soapFactory.getDefaultFaultEnvelope();
String errorCodeString = "Some Error occurred !!";
soapEnvelope.getBody().getFault().getCode().getValue().setText(errorCodeString);
SOAPFaultCode code = soapEnvelope.getBody().getFault().getCode();
envelope.getBody().getFault().setCode(code);
assertTrue("Parent Value of Code has not been set to new fault", code.getParent() == envelope.getBody().getFault());
assertTrue("Parent Value of Code is still pointing to old fault", code.getParent() != soapEnvelope.getBody().getFault());
assertNull("Old fault must not have a fault code", soapEnvelope.getBody().getFault().getCode());
assertEquals("The SOAP Code value must be " + errorCodeString, errorCodeString, envelope.getBody().getFault().getCode().getValue().getText());
}
Aggregations