Search in sources :

Example 6 with SOAPFaultCode

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

the class TestSetValueFromQName method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFaultCode code = soapFactory.getDefaultFaultEnvelope().getBody().getFault().getCode();
    code.setValue(new QName("urn:test", "MyFaultCode", "p"));
    assertEquals("p:MyFaultCode", code.getText());
    Iterator<OMNamespace> it = code.getAllDeclaredNamespaces();
    assertTrue(it.hasNext());
    OMNamespace ns = it.next();
    assertEquals("p", ns.getPrefix());
    assertEquals("urn:test", ns.getNamespaceURI());
}
Also used : OMNamespace(org.apache.axiom.om.OMNamespace) SOAPFaultCode(org.apache.axiom.soap.SOAPFaultCode) QName(javax.xml.namespace.QName)

Example 7 with SOAPFaultCode

use of org.apache.axiom.soap.SOAPFaultCode 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());
}
Also used : SOAPFaultCode(org.apache.axiom.soap.SOAPFaultCode) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 8 with SOAPFaultCode

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

the class TestGetValueWithParser method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    SOAPFaultCode faultCode = envelope.getBody().getFault().getCode();
    assertNotNull("SOAP 1.2 Fault Code Test with parser : - getValue method returns null", faultCode.getValue());
    assertEquals("SOAP 1.2 Fault Code Test with parser : - Value local name mismatch", SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, faultCode.getValue().getLocalName());
}
Also used : SOAPFaultCode(org.apache.axiom.soap.SOAPFaultCode)

Example 9 with SOAPFaultCode

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

the class SOAP12Factory method getDefaultFaultEnvelope.

@Override
public final SOAPEnvelope getDefaultFaultEnvelope() {
    SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
    SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());
    SOAPFaultCode faultCode = createSOAPFaultCode(fault);
    createSOAPFaultValue(faultCode);
    SOAPFaultReason reason = createSOAPFaultReason(fault);
    createSOAPFaultText(reason);
    createSOAPFaultDetail(fault);
    return defaultEnvelope;
}
Also used : SOAPFaultCode(org.apache.axiom.soap.SOAPFaultCode) SOAPFaultReason(org.apache.axiom.soap.SOAPFaultReason) SOAPFault(org.apache.axiom.soap.SOAPFault) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Example 10 with SOAPFaultCode

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

the class TestGetValueAsQNameWithParser method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    SOAPFaultCode faultCode = envelope.getBody().getFault().getCode();
    assertEquals(spec.getReceiverFaultCode(), faultCode.getValueAsQName());
}
Also used : SOAPFaultCode(org.apache.axiom.soap.SOAPFaultCode)

Aggregations

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