Package org.apache.axis2.soap

Examples of org.apache.axis2.soap.SOAPFault


                    TwoWayTransportBasedSender.send(msgctx, listenerTransport);

            //check for a fault and return the result
            SOAPEnvelope resenvelope = response.getEnvelope();
            if (resenvelope.getBody().hasFault()) {
                SOAPFault soapFault = resenvelope.getBody().getFault();
                Exception ex = soapFault.getException();

                if (isExceptionToBeThrownOnSOAPFault) {
                    //does the SOAPFault has a detail element for Excpetion
                    if (ex != null) {
                        throw new AxisFault(ex);
                    } else {
                        //if detail element not present create a new Exception from the detail
                        String message = "";
                        message = message + "Code =" + soapFault.getCode()==null?"":
                                soapFault.getCode().getValue()==null?"":soapFault.getCode().getValue().getText();
                        message = message + "Reason =" + soapFault.getReason()==null?"":
                                soapFault.getReason().getSOAPText()==null?"":soapFault.getReason().getSOAPText().getText();
                        throw new AxisFault(message);
                    }
                }
            }
            return response;
View Full Code Here


        SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
        SOAPEnvelope soapEnvelope = getTwoHeadersSOAPEnvelope(fac);
        SOAPEnvelope resposeEnvelope = getResponse(soapEnvelope);

        checkSOAPFaultContent(resposeEnvelope);
        SOAPFault fault = resposeEnvelope.getBody().getFault();
        assertEquals(fault.getCode().getValue().getText().trim(), SOAP12Constants.FAULT_CODE_SENDER);

        fac = OMAbstractFactory.getSOAP11Factory();
        soapEnvelope = getTwoHeadersSOAPEnvelope(fac);
        resposeEnvelope = getResponse(soapEnvelope);

        checkSOAPFaultContent(resposeEnvelope);
        fault = resposeEnvelope.getBody().getFault();
        assertEquals(fault.getCode().getValue().getText().trim(), SOAP11Constants.FAULT_CODE_SENDER);

    }
View Full Code Here

//        }
//    }

    private void checkSOAPFaultContent(SOAPEnvelope soapEnvelope) {
        assertTrue(soapEnvelope.getBody().hasFault());
        SOAPFault fault = soapEnvelope.getBody().getFault();
        assertNotNull(fault.getCode());
        assertNotNull(fault.getCode().getValue());
        assertNotNull(fault.getReason());
        assertNotNull(fault.getReason().getText());
    }
View Full Code Here

    public SOAP12BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
        super(envelope, builder);
    }

    public SOAPFault addFault(Exception e) throws OMException {
        SOAPFault soapFault = new SOAP12FaultImpl(this, e);
        this.hasSOAPFault = true;
        return soapFault;
    }
View Full Code Here

        try {
            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
                    getTestResourceFile("soap/soapmessage.xml"));
            SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
            SOAPBody soapBody = soapEnvelope.getBody();
            SOAPFault soapFault = omFactory.createSOAPFault(soapBody,
                    new Exception(" this is just a test "));
            assertTrue(
                    "Programatically created SOAPFault should have done = true ",
                    soapFault.isComplete());
            soapFault.detach();
            SOAPFault soapFaultTwo = omFactory.createSOAPFault(soapBody,
                    omBuilder);
            assertTrue(
                    "SOAPFault with a builder should start with done = false ",
                    !soapFaultTwo.isComplete());
            assertTrue("This SOAPFault must have a builder ",
                    soapFaultTwo.getBuilder() instanceof OMXMLParserWrapper);


        } catch (Exception e) {
            log.info(e.getMessage());
        }
View Full Code Here

                    send(msgctx, clientOptions.getListenerTransport());

            //check for a fault and return the result
            SOAPEnvelope resenvelope = response.getEnvelope();
            if (resenvelope.getBody().hasFault()) {
                SOAPFault soapFault = resenvelope.getBody().getFault();
                Exception ex = soapFault.getException();

                if (clientOptions.isExceptionToBeThrownOnSOAPFault()) {
                    //does the SOAPFault has a detail element for Excpetion
                    if (ex != null) {
                        throw new AxisFault(ex);
                    } else {
                        //if detail element not present create a new Exception from the detail
                        String message = "";
                        message = message + "Code =" + soapFault.getCode() == null ? "" :
                                soapFault.getCode().getValue() == null ? "" : soapFault.getCode().getValue().getText();
                        message = message + "Reason =" + soapFault.getReason() == null ? "" :
                                soapFault.getReason().getSOAPText() == null ? "" : soapFault.getReason().getSOAPText().getText();
                        throw new AxisFault(message);
                    }
                }
            }
            return response;
View Full Code Here

    throw new UnsupportedOperationException();
  }

  public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());

        SOAPFaultCode faultCode = createSOAPFaultCode(fault);
        SOAPFaultValue value = createSOAPFaultValue(faultCode);

        SOAPFaultReason reason = createSOAPFaultReason(fault);
View Full Code Here

    public SOAP11BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
        super(envelope, builder);
    }

    public SOAPFault addFault(Exception e) throws OMException {
      SOAPFault soapFault = new SOAP12FaultImpl(this, e);
      this.hasSOAPFault = true;
      return soapFault;
    }
View Full Code Here

                if (expectedEnvelope.getHeader() != null)
                    super.compare(ReplyEnvelope.getHeader(), expectedEnvelope.getHeader());

                if (expectedEnvelope.getBody().hasFault()) {
                    SOAPFault replyFault = ReplyEnvelope.getBody().getFault();
                    SOAPFault expectedFault = expectedEnvelope.getBody().getFault();

                    super.compare(replyFault.getCode(), expectedFault.getCode());
                    super.compare(replyFault.getReason(), expectedFault.getReason());

                    if (expectedFault.getRole() != null) {
                        super.compare(replyFault.getRole(), expectedFault.getRole());
                    }
                    if (expectedFault.getNode() != null) {
                        super.compare(replyFault.getNode(), expectedFault.getNode());
                    }
                    if (expectedFault.getDetail() != null) {
                        super.compare(replyFault.getDetail(), expectedFault.getDetail());
                    }
                } else {
                    super.compare(ReplyEnvelope.getBody(), expectedEnvelope.getBody());
                }
            } else {
View Full Code Here

        throw new UnsupportedOperationException();
    }

    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());

        SOAPFaultCode faultCode = createSOAPFaultCode(fault);
        SOAPFaultValue value = createSOAPFaultValue(faultCode);

        SOAPFaultReason reason = createSOAPFaultReason(fault);
View Full Code Here

TOP

Related Classes of org.apache.axis2.soap.SOAPFault

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.