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.builder;
8   
9   import org.mule.api.lifecycle.CreateException;
10  import org.mule.module.cxf.support.CxfUtils;
11  
12  import org.apache.cxf.aegis.databinding.AegisDatabinding;
13  import org.apache.cxf.endpoint.Client;
14  import org.apache.cxf.frontend.ClientProxy;
15  import org.apache.cxf.frontend.ClientProxyFactoryBean;
16  
17  public class SimpleClientMessageProcessorBuilder extends AbstractClientMessageProcessorBuilder
18  {
19      @Override
20      protected Client createClient() throws CreateException, Exception
21      {
22          ClientProxyFactoryBean cpf = new ClientProxyFactoryBean();
23          cpf.setServiceClass(serviceClass);
24          if (databinding == null) 
25          {
26              cpf.setDataBinding(new AegisDatabinding());
27          }
28          else 
29          {
30              cpf.setDataBinding(databinding);
31          }
32          cpf.setAddress(getAddress());
33          cpf.setBus(getBus());
34          cpf.setProperties(properties);
35  
36          if (wsdlLocation != null)
37          {
38              cpf.setWsdlLocation(wsdlLocation);
39          }
40  
41          // If there's a soapVersion defined then the corresponding bindingId will be set
42          if(soapVersion != null)
43          {
44              cpf.setBindingId(CxfUtils.getBindingIdForSoapVersion(soapVersion));
45          }
46  
47          return ClientProxy.getClient(cpf.create());
48      }
49  }