Package org.springframework.ws.soap

Examples of org.springframework.ws.soap.SoapBody


                new ClassPathResource("soap12.xsd", AbstractSoap12MessageTestCase.class)};
    }

    @Override
    public void testWriteToTransportOutputStream() throws Exception {
        SoapBody body = soapMessage.getSoapBody();
        String payload = "<payload xmlns='http://www.springframework.org' />";
        transformer.transform(new StringSource(payload), body.getPayloadResult());

        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
        MockTransportOutputStream tos = new MockTransportOutputStream(bos);
        String soapAction = "http://springframework.org/spring-ws/Action";
        soapMessage.setSoapAction(soapAction);
View Full Code Here


    @Override
    public void testWriteToTransportOutputStream() throws Exception {
        super.testWriteToTransportOutputStream();

        SoapBody body = soapMessage.getSoapBody();
        OMSourcedElementImpl axiomPayloadEle =
                (OMSourcedElementImpl) ((AxiomSoapBody) body).getAxiomElement().getFirstElement();
        assertFalse("Non-cached body should not be expanded now", axiomPayloadEle.isExpanded());
        axiomPayloadEle.getFirstElement();
        assertTrue("Non-cached body should now be expanded", axiomPayloadEle.isExpanded());
View Full Code Here

                new SoapEndpointInvocationChain(new Object(), new SoapEndpointInterceptor[]{interceptorMock});

        boolean result = dispatcher.handleRequest(chain, context);
        Assert.assertFalse("Header understood", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapBody responseBody = ((SoapMessage) context.getResponse()).getSoapBody();
        Assert.assertTrue("Response body has no fault", responseBody.hasFault());
        Soap11Fault fault = (Soap11Fault) responseBody.getFault();
        Assert.assertEquals("Invalid fault code", new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "MustUnderstand"),
                fault.getFaultCode());
        Assert.assertEquals("Invalid fault string", SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING,
                fault.getFaultStringOrReason());
        Assert.assertEquals("Invalid fault string locale", Locale.ENGLISH, fault.getFaultStringLocale());
View Full Code Here

        boolean result = dispatcher.handleRequest(chain, context);
        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();
View Full Code Here

    @Override
    public void testWriteToTransportOutputStream() throws Exception {
        super.testWriteToTransportOutputStream();

        SoapBody body = soapMessage.getSoapBody();
        OMSourcedElementImpl axiomPayloadEle =
                (OMSourcedElementImpl) ((AxiomSoapBody) body).getAxiomElement().getFirstElement();
        assertFalse("Non-cached body should not be expanded now", axiomPayloadEle.isExpanded());
        axiomPayloadEle.getFirstElement();
        assertTrue("Non-cached body should now be expanded", axiomPayloadEle.isExpanded());
View Full Code Here

        Assert.assertEquals("Invalid SOAP version", SoapVersion.SOAP_11, soapMessage.getVersion());
    }

    @Override
    public void testWriteToTransportOutputStream() throws Exception {
        SoapBody body = soapMessage.getSoapBody();
        String payload = "<payload xmlns='http://www.springframework.org' />";
        transformer.transform(new StringSource(payload), body.getPayloadResult());

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        MockTransportOutputStream tos = new MockTransportOutputStream(bos);
        String soapAction = "http://springframework.org/spring-ws/Action";
        soapMessage.setSoapAction(soapAction);
View Full Code Here

        } else {
            faultstring = String.format(FAULT_STRING_FORMAT, wsopName, exMsg);
        }

        final SoapMessage response = (SoapMessage) msgctx.getResponse();
        final SoapBody body = response.getSoapBody();
        body.addServerOrReceiverFault(faultstring, Locale.ENGLISH);
        return true;
    }
View Full Code Here

        client.getEndpointConfiguration().setErrorHandlingStrategy(ErrorHandlingStrategy.THROWS_EXCEPTION);

        Message requestMessage = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");

        org.springframework.ws.soap.SoapMessage soapFaultMessage = EasyMock.createMock(org.springframework.ws.soap.SoapMessage.class);
        SoapBody soapBody = EasyMock.createMock(SoapBody.class);
        SoapFault soapFault = EasyMock.createMock(SoapFault.class);

        reset(webServiceTemplate, soapFaultMessage, soapBody, soapFault);

        webServiceTemplate.setDefaultUri("http://localhost:8080/request");
        expectLastCall().once();

        webServiceTemplate.setFaultMessageResolver(anyObject(FaultMessageResolver.class));
        expectLastCall().once();

        expect(soapFaultMessage.getSoapBody()).andReturn(soapBody).anyTimes();
        expect(soapFaultMessage.getFaultReason()).andReturn("Internal server error").anyTimes();
        expect(soapBody.getFault()).andReturn(soapFault).once();

        replay(soapFaultMessage, soapBody, soapFault);

        expect(webServiceTemplate.sendAndReceive(eq("http://localhost:8080/request"), (WebServiceMessageCallback)anyObject(),
                (WebServiceMessageCallback)anyObject())).andThrow(new SoapFaultClientException(soapFaultMessage)).once();
View Full Code Here

TOP

Related Classes of org.springframework.ws.soap.SoapBody

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.