1 10 11 package org.mule.providers.soap.xfire.wsdl; 12 13 import java.net.URL ; 14 15 import javax.xml.namespace.QName ; 16 17 import org.apache.commons.pool.impl.StackObjectPool; 18 import org.codehaus.xfire.XFire; 19 import org.codehaus.xfire.client.Client; 20 import org.codehaus.xfire.service.Service; 21 import org.mule.providers.soap.xfire.XFireMessageDispatcher; 22 import org.mule.umo.endpoint.UMOImmutableEndpoint; 23 24 27 public class XFireWsdlMessageDispatcher extends XFireMessageDispatcher 28 { 29 30 public XFireWsdlMessageDispatcher(UMOImmutableEndpoint endpoint) 31 { 32 super(endpoint); 33 } 34 35 protected void doConnect(final UMOImmutableEndpoint endpoint) throws Exception 36 { 37 try 38 { 39 XFire xfire = connector.getXfire(); 40 String wsdlUrl = endpoint.getEndpointURI().getAddress(); 41 String serviceName = wsdlUrl.substring(0, wsdlUrl.lastIndexOf('?')); 42 Service service = xfire.getServiceRegistry().getService(new QName (serviceName)); 43 44 if (service == null) 45 { 46 service = new Client(new URL (wsdlUrl)).getService(); 47 service.setName(new QName (serviceName)); 48 xfire.getServiceRegistry().register(service); 49 } 50 51 clientPool = new StackObjectPool(new XFireWsdlClientPoolFactory(endpoint, service, xfire)); 52 clientPool.addObject(); 53 } 54 catch (Exception ex) 55 { 56 disconnect(); 57 throw ex; 58 } 59 } 60 } 61 | Popular Tags |