View Javadoc

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