Package org.springframework.ws.soap.soap12

Examples of org.springframework.ws.soap.soap12.Soap12Header


        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

        if (!ObjectUtils.isEmpty(actorsOrRoles)) {
            fault.setFaultActorOrRole(actorsOrRoles[0]);
        }
        SoapHeader header = soapResponse.getSoapHeader();
        if (header instanceof Soap12Header) {
            Soap12Header soap12Header = (Soap12Header) header;
            for (QName headerName : notUnderstoodHeaderNames) {
                soap12Header.addNotUnderstoodHeaderElement(headerName);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.ws.soap.soap12.Soap12Header

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.