View Javadoc

1   /*
2    * $Id$
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.test.integration.transport.cxf;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  import org.custommonkey.xmlunit.XMLAssert;
18  
19  public class CxfEnvelopePayloadWithWsdlTestCase extends FunctionalTestCase
20  {
21  
22      final String msg = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" "
23                         + "xmlns:emop=\"http://www.wcs.com/2010/07/14/emop\">"
24                         + "  <soapenv:Header>\n"
25                         + "    <header UserName=\"nothing\" Password=\"important\"/>\n"
26                         + "  </soapenv:Header>\n"
27                         + "  <soapenv:Body>\n"
28                         + "    <emop:ScratchcardValidateAndPayRequestBody>\n"
29                         + "       <ScratchcardNumber>1</ScratchcardNumber>\n"
30                         + "       <VirnNumber>2</VirnNumber>\n"
31                         + "    </emop:ScratchcardValidateAndPayRequestBody>\n"
32                         + "  </soapenv:Body>\n"
33                         + "</soapenv:Envelope>";
34  
35      @Override
36      protected String getConfigResources()
37      {
38          return "org/mule/test/integration/transport/cxf/scratchcard-service-config.xml";
39      }
40  
41      public void testEnvelopePayloadIsProcessedWhenMessageAndWsdlContainsHeaders() throws Exception
42      {
43          MuleClient client = new MuleClient(muleContext);
44  
45          MuleMessage result = client.send("http://localhost:28182/ScratchCardServiceV1", msg, null);
46  
47          assertNotNull("The result shouln't have been null", result);
48          final String payloadAsString = result.getPayloadAsString();
49          XMLAssert.assertXMLEqual(msg, payloadAsString);
50      }
51  }