View Javadoc

1   /*
2    * $Id: SimpleClientMessageProcessorBuilder.java 19191 2010-08-25 21:05:23Z tcarlson $
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  
15  import org.apache.cxf.aegis.databinding.AegisDatabinding;
16  import org.apache.cxf.endpoint.Client;
17  import org.apache.cxf.frontend.ClientProxy;
18  import org.apache.cxf.frontend.ClientProxyFactoryBean;
19  
20  public class SimpleClientMessageProcessorBuilder extends AbstractClientMessageProcessorBuilder
21  {
22      @Override
23      protected Client createClient() throws CreateException, Exception
24      {
25          ClientProxyFactoryBean cpf = new ClientProxyFactoryBean();
26          cpf.setServiceClass(serviceClass);
27          if (databinding == null) 
28          {
29              cpf.setDataBinding(new AegisDatabinding());
30          }
31          else 
32          {
33              cpf.setDataBinding(databinding);
34          }
35          cpf.setAddress(getAddress());
36          cpf.setBus(getBus());
37          cpf.setProperties(properties);
38          
39          if (wsdlLocation != null)
40          {
41              cpf.setWsdlLocation(wsdlLocation);
42          }
43  
44          return ClientProxy.getClient(cpf.create());
45      }
46  }