Package javax.wsdl.extensions.soap12

Examples of javax.wsdl.extensions.soap12.SOAP12Fault


        boolean result = resolver.resolveException(context, null, new MyReceiverException());
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
        Assert.assertTrue("Resonse has no fault", response.getSoapBody().hasFault());
        Soap12Fault fault = (Soap12Fault) response.getSoapBody().getFault();
        Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_12.getServerOrReceiverFaultName(),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string on fault", "Receiver error", fault.getFaultReasonText(Locale.ENGLISH));
        Assert.assertNull("Detail on fault", fault.getFaultDetail());
    }
View Full Code Here


                Soap11Body soap11Body = (Soap11Body) soapBody;
                fault = soap11Body.addFault(definition.getFaultCode(), faultStringOrReason, definition.getLocale());
            }
            else if (soapBody instanceof Soap12Body) {
                Soap12Body soap12Body = (Soap12Body) soapBody;
                Soap12Fault soap12Fault = soap12Body.addServerOrReceiverFault(faultStringOrReason, definition
                        .getLocale());
                soap12Fault.addFaultSubcode(definition.getFaultCode());
                fault = soap12Fault;
            }
            else {
                throw new IllegalStateException("This class only supports SOAP 1.1 and SOAP 1.2.");
            }
View Full Code Here

        boolean result = resolver.resolveException(context, null, new IllegalArgumentException("bla"));
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
        Assert.assertTrue("Response has no fault", response.getSoapBody().hasFault());
        Soap12Fault fault = (Soap12Fault) response.getSoapBody().getFault();
        Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_12.getClientOrSenderFaultName(),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string on fault", "Sender error", fault.getFaultReasonText(Locale.ENGLISH));
        Assert.assertNull("Detail on fault", fault.getFaultDetail());
    }
View Full Code Here

        boolean result = resolver.resolveException(context, null, new IllegalArgumentException("bla"));
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
        Assert.assertTrue("Response has no fault", response.getSoapBody().hasFault());
        Soap12Fault fault = (Soap12Fault) response.getSoapBody().getFault();
        Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_12.getServerOrReceiverFaultName(),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string on fault", "Receiver error", fault.getFaultReasonText(Locale.ENGLISH));
        Assert.assertNull("Detail on fault", fault.getFaultDetail());
    }
View Full Code Here

    }

    @Override
    public Soap12Fault addDataEncodingUnknownFault(QName[] subcodes, String reason, Locale locale) {
        QName name = new QName(SoapVersion.SOAP_12.getEnvelopeNamespaceUri(), "DataEncodingUnknown");
        Soap12Fault fault = addFault(name, reason, locale);
        for (QName subcode : subcodes) {
            fault.addFaultSubcode(subcode);
        }
        return fault;
    }
View Full Code Here

            Soap11Body soapBody = (Soap11Body) message.getSoapBody();
            return soapBody.addFault(subcode, reason, Locale.ENGLISH);
        }
        else if (message.getSoapBody() instanceof Soap12Body) {
            Soap12Body soapBody = (Soap12Body) message.getSoapBody();
            Soap12Fault soapFault =
                soapBody.addClientOrSenderFault(reason, Locale.ENGLISH);
            soapFault.addFaultSubcode(subcode);
            return soapFault;
        }
        return null;
    }
View Full Code Here

        boolean result = interceptor.handleRequest(context, null);
        Assert.assertFalse("Invalid response from interceptor", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
        Assert.assertTrue("Response has no fault", response.getSoapBody().hasFault());
        Soap12Fault fault = (Soap12Fault) response.getSoapBody().getFault();
        Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_12.getClientOrSenderFaultName(),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string on fault", PayloadValidatingInterceptor.DEFAULT_FAULTSTRING_OR_REASON,
                fault.getFaultReasonText(Locale.ENGLISH));
        Assert.assertNotNull("No Detail on fault", fault.getFaultDetail());
    }
View Full Code Here

        Assert.assertFalse("Header understood", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
        SoapBody responseBody = response.getSoapBody();
        Assert.assertTrue("Response body has no fault", responseBody.hasFault());
        Soap12Fault fault = (Soap12Fault) responseBody.getFault();
        Assert.assertEquals("Invalid fault code", new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "MustUnderstand"),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string", SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING,
                fault.getFaultReasonText(Locale.ENGLISH));
        SoapHeader responseHeader = response.getSoapHeader();
        Iterator<SoapHeaderElement> iterator = responseHeader.examineAllHeaderElements();
        Assert.assertTrue("Response header has no elements", iterator.hasNext());
        SoapHeaderElement headerElement = iterator.next();
        Assert.assertEquals("No NotUnderstood header",
View Full Code Here

            soapFault = soap11Body.addFault(replyMessage.getFaultCodeQName(),
                    replyMessage.getFaultString(),
                    replyMessage.getLocale());
        } else if (soapBody instanceof Soap12Body) {
            Soap12Body soap12Body = (Soap12Body) soapBody;
            Soap12Fault soap12Fault = soap12Body.addServerOrReceiverFault(replyMessage.getFaultString(),
                            replyMessage.getLocale());
            soap12Fault.addFaultSubcode(replyMessage.getFaultCodeQName());
           
            soapFault = soap12Fault;
        } else {
                throw new CitrusRuntimeException("Found unsupported SOAP implementation. Use SOAP 1.1 or SOAP 1.2.");
        }
View Full Code Here

        SoapHeader soapRequestHeader = EasyMock.createMock(SoapHeader.class);

        org.springframework.ws.soap.SoapMessage soapResponse = EasyMock.createMock(org.springframework.ws.soap.SoapMessage.class);
        SoapHeader soapResponseHeader = EasyMock.createMock(SoapHeader.class);
        Soap12Body soapResponseBody = EasyMock.createMock(Soap12Body.class);
        final Soap12Fault soapFault = EasyMock.createMock(Soap12Fault.class);
       
        StringResult soapResponsePayload = new StringResult();
       
        reset(messageContext, soapRequest, soapRequestHeader, soapResponse, soapResponseHeader, soapResponseBody, soapFault);
       
        expect(messageContext.getRequest()).andReturn(soapRequest).anyTimes();
       
        expect(soapRequest.getPayloadSource()).andReturn(new StringSource("<TestRequest><Message>Hello World!</Message></TestRequest>")).times(2);
       
        expect(messageContext.getPropertyNames()).andReturn(new String[]{}).once();
       
        expect(soapRequest.getSoapHeader()).andReturn(soapRequestHeader).once();
        expect(soapRequestHeader.getSource()).andReturn(null).once();
       
        Set<SoapHeaderElement> emptyHeaderSet = Collections.emptySet();
        expect(soapRequestHeader.examineAllHeaderElements()).andReturn(emptyHeaderSet.iterator()).once();
       
        expect(soapRequest.getSoapAction()).andReturn("sayHello").anyTimes();
       
        Set<Attachment> emptyAttachmentSet = Collections.emptySet();
        expect(soapRequest.getAttachments()).andReturn(emptyAttachmentSet.iterator()).once();
       
        expect(messageContext.getResponse()).andReturn(soapResponse).once();

        expect(soapResponse.getSoapHeader()).andReturn(soapResponseHeader).anyTimes();
       
        expect(soapResponse.getSoapBody()).andReturn(soapResponseBody).once();
       
        expect(soapResponseBody.addServerOrReceiverFault((String)anyObject(), (Locale)anyObject())).andAnswer(new IAnswer<Soap12Fault>() {
            public Soap12Fault answer() throws Throwable {
                Assert.assertEquals(EasyMock.getCurrentArguments()[0], "Invalid request");
               
                return soapFault;
            }
        });
       
        soapFault.addFaultSubcode((QName)anyObject());
        expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                QName faultQName = (QName)EasyMock.getCurrentArguments()[0];
               
                Assert.assertEquals(faultQName.getLocalPart(), "TEC-1000");
View Full Code Here

TOP

Related Classes of javax.wsdl.extensions.soap12.SOAP12Fault

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.