1 29 30 package com.caucho.soap.jaxws; 31 32 import com.caucho.soap.reflect.WebServiceIntrospector; 33 import com.caucho.soap.skeleton.Skeleton; 34 import com.caucho.util.L10N; 35 36 import javax.xml.bind.JAXBContext; 37 import javax.xml.namespace.QName ; 38 import javax.xml.ws.BindingProvider; 39 import javax.xml.ws.Dispatch; 40 import javax.xml.ws.Service; 41 import javax.xml.ws.handler.HandlerResolver; 42 import javax.xml.ws.spi.ServiceDelegate; 43 import java.lang.reflect.Proxy ; 44 import java.net.URL ; 45 import java.util.Iterator ; 46 import java.util.concurrent.Executor ; 47 import java.util.logging.Logger ; 48 49 52 public class ServiceDelegateImpl extends ServiceDelegate { 53 private final static Logger log 54 = Logger.getLogger(ServiceDelegateImpl.class.getName()); 55 private final static L10N L = new L10N(ServiceDelegateImpl.class); 56 57 private final ClassLoader _classLoader; 58 59 private final URL _wsdl; 60 private final QName _serviceName; 61 private final Class _serviceClass; 62 63 ServiceDelegateImpl(URL wsdl, QName serviceName, Class serviceClass) 64 { 65 _classLoader = Thread.currentThread().getContextClassLoader(); 66 67 _wsdl = wsdl; 68 _serviceName = serviceName; 69 _serviceClass = serviceClass; 70 } 71 72 public void addPort(QName portName, 73 String bindingId, 74 String endpointAddress) 75 { 76 throw new UnsupportedOperationException (); 77 } 78 79 public <T> Dispatch<T> createDispatch(QName portName, 80 Class <T> type, 81 Service.Mode mode) 82 { 83 throw new UnsupportedOperationException (); 84 } 85 86 87 public Dispatch<Object > createDispatch(QName portName, 88 JAXBContext context, 89 Service.Mode mode) 90 { 91 throw new UnsupportedOperationException (); 92 } 93 94 public Executor getExecutor() 95 { 96 throw new UnsupportedOperationException (); 97 } 98 99 public HandlerResolver getHandlerResolver() 100 { 101 throw new UnsupportedOperationException (); 102 } 103 104 public <T> T getPort(Class <T> serviceEndpointInterface) 105 { 106 return getPort(null, serviceEndpointInterface); 107 } 108 109 public <T> T getPort(QName portName, Class <T> api) 110 { 111 try { 112 String url = null; 113 114 if (portName != null) 115 url = portName.getNamespaceURI(); 116 117 if (url == null) 118 url = _serviceName.getNamespaceURI(); 119 120 Skeleton skeleton = new WebServiceIntrospector().introspect(api, url); 121 122 124 PortProxyHandler handler = new PortProxyHandler(skeleton, url); 125 126 return (T) Proxy.newProxyInstance(_classLoader, 127 new Class [] { api, 128 BindingProvider.class }, 129 handler); 130 } catch (RuntimeException e) { 131 throw e; 132 } catch (Exception e) { 133 throw new RuntimeException (e); 135 } 136 } 137 138 public Iterator <QName > getPorts() 139 { 140 throw new UnsupportedOperationException (); 141 } 142 143 public QName getServiceName() 144 { 145 return _serviceName; 146 } 147 148 149 public URL getWSDLDocumentLocation() 150 { 151 return _wsdl; 152 } 153 154 public void setExecutor(Executor executor) 155 { 156 } 157 158 public void setHandlerResolver(HandlerResolver handlerResolver) 159 { 160 } 161 162 public String toString() 163 { 164 return ("ServiceDelegateImpl[" + getServiceName().getNamespaceURI() 165 + "," + getServiceName().getLocalPart() + "]"); 166 } 167 } 168 | Popular Tags |