KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > soap > xfire > wsdl > XFireWsdlMessageDispatcher


1 /*
2  * $Id: XFireWsdlMessageDispatcher.java 3937 2006-11-20 16:04:25Z lajos $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.providers.soap.xfire.wsdl;
12
13 import java.net.URL JavaDoc;
14
15 import javax.xml.namespace.QName JavaDoc;
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 /**
25  * TODO document
26  */

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 JavaDoc
36     {
37         try
38         {
39             XFire xfire = connector.getXfire();
40             String JavaDoc wsdlUrl = endpoint.getEndpointURI().getAddress();
41             String JavaDoc serviceName = wsdlUrl.substring(0, wsdlUrl.lastIndexOf('?'));
42             Service service = xfire.getServiceRegistry().getService(new QName JavaDoc(serviceName));
43
44             if (service == null)
45             {
46                 service = new Client(new URL JavaDoc(wsdlUrl)).getService();
47                 service.setName(new QName JavaDoc(serviceName));
48                 xfire.getServiceRegistry().register(service);
49             }
50
51             clientPool = new StackObjectPool(new XFireWsdlClientPoolFactory(endpoint, service, xfire));
52             clientPool.addObject();
53         }
54         catch (Exception JavaDoc ex)
55         {
56             disconnect();
57             throw ex;
58         }
59     }
60 }
61
Popular Tags