Search in sources :

Example 16 with SOAPFault

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

the class TestWrongParent2 method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope parent = soapFactory.createSOAPEnvelope();
    OMElement child1 = soapFactory.createSOAPHeader(parent);
    SOAPFault fault = soapFactory.createSOAPFault();
    try {
        child1.insertSiblingAfter(fault);
        fail("Expected SOAPProcessingException");
    } catch (SOAPProcessingException ex) {
    // Expected
    }
}
Also used : SOAPProcessingException(org.apache.axiom.soap.SOAPProcessingException) OMElement(org.apache.axiom.om.OMElement) SOAPFault(org.apache.axiom.soap.SOAPFault) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 17 with SOAPFault

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

the class TestWrongParent3 method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPHeader parent = soapFactory.createSOAPHeader();
    OMElement child1 = soapFactory.createSOAPHeaderBlock("child1", soapFactory.createOMNamespace("urn:test", "p"), parent);
    SOAPFault fault = soapFactory.createSOAPFault();
    try {
        child1.insertSiblingBefore(fault);
        fail("Expected SOAPProcessingException");
    } catch (SOAPProcessingException ex) {
    // Expected
    }
}
Also used : SOAPProcessingException(org.apache.axiom.soap.SOAPProcessingException) OMElement(org.apache.axiom.om.OMElement) SOAPFault(org.apache.axiom.soap.SOAPFault) SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Example 18 with SOAPFault

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

the class TestAddDetailEntry 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));
    Iterator<OMElement> iterator = soapFaultDetail.getAllDetailEntries();
    OMElement detailEntry1 = iterator.next();
    assertNotNull("SOAP Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns empty iterator", detailEntry1);
    assertEquals("SOAP Fault Detail Test : - detailEntry1 local name mismatch", "DetailEntry1", detailEntry1.getLocalName());
    assertEquals("SOAP Fault Detail Test : - detailEntry1 namespace uri mismatch", "http://www.test.org", detailEntry1.getNamespace().getNamespaceURI());
    OMElement detailEntry2 = iterator.next();
    assertNotNull("SOAP Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with only one object", detailEntry2);
    assertEquals("SOAP Fault Detail Test : - detailEntry2 local name mismatch", "DetailEntry2", detailEntry2.getLocalName());
    assertEquals("SOAP Fault Detail Test : - detailEntry2 namespace uri mismatch", "http://www.test.org", detailEntry2.getNamespace().getNamespaceURI());
    assertFalse("SOAP Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with three objects", iterator.hasNext());
}
Also used : SOAPBody(org.apache.axiom.soap.SOAPBody) OMNamespace(org.apache.axiom.om.OMNamespace) SOAPFaultDetail(org.apache.axiom.soap.SOAPFaultDetail) SOAPFault(org.apache.axiom.soap.SOAPFault) OMElement(org.apache.axiom.om.OMElement) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 19 with SOAPFault

use of org.apache.axiom.soap.SOAPFault 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());
}
Also used : SOAPBody(org.apache.axiom.soap.SOAPBody) OMNamespace(org.apache.axiom.om.OMNamespace) SOAPFaultDetail(org.apache.axiom.soap.SOAPFaultDetail) SOAPFault(org.apache.axiom.soap.SOAPFault) OMElement(org.apache.axiom.om.OMElement) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 20 with SOAPFault

use of org.apache.axiom.soap.SOAPFault 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);
}
Also used : SOAPBody(org.apache.axiom.soap.SOAPBody) OMNamespace(org.apache.axiom.om.OMNamespace) StringWriter(java.io.StringWriter) SOAPFaultDetail(org.apache.axiom.soap.SOAPFaultDetail) SOAPFault(org.apache.axiom.soap.SOAPFault) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Aggregations

SOAPFault (org.apache.axiom.soap.SOAPFault)35 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)13 OMElement (org.apache.axiom.om.OMElement)12 SOAPFaultReason (org.apache.axiom.soap.SOAPFaultReason)10 SOAPFaultDetail (org.apache.axiom.soap.SOAPFaultDetail)9 SOAPFaultCode (org.apache.axiom.soap.SOAPFaultCode)8 SOAPBody (org.apache.axiom.soap.SOAPBody)7 QName (javax.xml.namespace.QName)6 SOAPProcessingException (org.apache.axiom.soap.SOAPProcessingException)4 StringReader (java.io.StringReader)3 OMNamespace (org.apache.axiom.om.OMNamespace)3 OMNode (org.apache.axiom.om.OMNode)3 SOAPFaultRole (org.apache.axiom.soap.SOAPFaultRole)3 SOAPFaultSubCode (org.apache.axiom.soap.SOAPFaultSubCode)3 SOAPFaultValue (org.apache.axiom.soap.SOAPFaultValue)3 SOAPHeader (org.apache.axiom.soap.SOAPHeader)3 SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)3 OMAttribute (org.apache.axiom.om.OMAttribute)2 OMXMLParserWrapper (org.apache.axiom.om.OMXMLParserWrapper)2 SOAPFaultNode (org.apache.axiom.soap.SOAPFaultNode)2