View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.cxf;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.endpoint.InboundEndpoint;
12  import org.mule.module.client.MuleClient;
13  import org.mule.tck.junit4.FunctionalTestCase;
14  import org.mule.tck.junit4.rule.DynamicPort;
15  
16  import org.junit.Rule;
17  import org.junit.Test;
18  
19  import static org.junit.Assert.assertEquals;
20  import static org.junit.Assert.assertNotNull;
21  
22  public class SoapRequestNoMethodParamTestCase extends FunctionalTestCase
23  {
24      private static final String request = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soap:Body><receive xmlns=\"http://www.muleumo.org\"><src xmlns=\"http://www.muleumo.org\">Test String</src></receive></soap:Body></soap:Envelope>";
25      private static final String response = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><ns1:receiveResponse xmlns:ns1=\"http://services.testmodels.tck.mule.org/\"><ns1:return>Received: null</ns1:return></ns1:receiveResponse></soap:Body></soap:Envelope>";
26  
27      @Rule
28      public DynamicPort dynamicPort = new DynamicPort("port1");
29  
30      @Override
31      protected String getConfigResources()
32      {
33          return "soap-request-conf.xml";
34      }
35  
36      @Test
37      public void testCXFSoapRequest() throws Exception
38      {
39          MuleClient client = new MuleClient(muleContext);
40  
41          MuleMessage msg = client.send(((InboundEndpoint) client.getMuleContext().getRegistry()
42                          .lookupObject("httpInbound")).getAddress(),
43              new DefaultMuleMessage(request, muleContext));
44  
45          assertNotNull(msg);
46          assertNotNull(msg.getPayload());
47          assertEquals(response, msg.getPayloadAsString());
48      }
49  
50  }