Search in sources :

Example 6 with SOAPFaultDetail

use of org.apache.axiom.soap.SOAPFaultDetail 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 7 with SOAPFaultDetail

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

the class TestDetailEntriesUsingDefaultNamespaceWithParser method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    SOAPFaultDetail soapFaultDetail = envelope.getBody().getFault().getDetail();
    OMElement detailElement = soapFaultDetail.getFirstElement();
    assertEquals("AddNumbersHandlerFault", detailElement.getLocalName());
    OMNamespace ns = detailElement.getNamespace();
    // At some point, there was a bug in Axiom that caused the prefix to be null
    assertEquals("", ns.getPrefix());
    assertEquals("http://www.example.org/addnumbershandler", ns.getNamespaceURI());
}
Also used : OMNamespace(org.apache.axiom.om.OMNamespace) SOAPFaultDetail(org.apache.axiom.soap.SOAPFaultDetail) OMElement(org.apache.axiom.om.OMElement)

Example 8 with SOAPFaultDetail

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

the class TestGetAllDetailEntriesWithParser method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    SOAPFaultDetail soapFaultDetail = envelope.getBody().getFault().getDetail();
    Iterator<OMElement> iterator = soapFaultDetail.getAllDetailEntries();
    OMElement detailEntry1 = iterator.next();
    assertNotNull("SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries", detailEntry1);
    assertEquals("SOAP Fault Detail Test With Parser : - detailEntry1 localname mismatch", "ErrorCode", detailEntry1.getLocalName());
    OMElement detailEntry2 = iterator.next();
    assertNotNull("SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with only one detail entries", detailEntry2);
    assertEquals("SOAP Fault Detail Test With Parser : - detailEntry2 localname mismatch", "Message", detailEntry2.getLocalName());
    assertFalse("SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with more than two detail entries", iterator.hasNext());
}
Also used : SOAPFaultDetail(org.apache.axiom.soap.SOAPFaultDetail) OMElement(org.apache.axiom.om.OMElement)

Example 9 with SOAPFaultDetail

use of org.apache.axiom.soap.SOAPFaultDetail 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 10 with SOAPFaultDetail

use of org.apache.axiom.soap.SOAPFaultDetail 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

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