1 7 package org.jboss.webservice.client; 8 9 11 import org.jboss.logging.Logger; 12 import org.jboss.util.NotImplementedException; 13 import org.jboss.webservice.deployment.ServiceDescription; 14 import org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMapping; 15 import org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMappingFactory; 16 import org.jboss.webservice.metadata.wsdl.WSDL11DefinitionFactory; 17 18 import javax.wsdl.Definition; 19 import javax.xml.namespace.QName ; 20 import javax.xml.rpc.Service ; 21 import javax.xml.rpc.ServiceException ; 22 import javax.xml.rpc.ServiceFactory ; 23 import java.net.URL ; 24 import java.util.Properties ; 25 26 36 public class ServiceFactoryImpl extends ServiceFactory 37 { 38 private final Logger log = Logger.getLogger(ServiceFactoryImpl.class); 40 41 49 public Service loadService(Class serviceInterface) throws ServiceException 50 { 51 throw new NotImplementedException(); 52 } 53 54 66 public Service loadService(URL wsdlDocumentLocation, Class serviceInterface, Properties props) throws ServiceException 67 { 68 throw new NotImplementedException(); 69 } 70 71 83 public Service loadService(URL wsdlDocumentLocation, QName serviceName, Properties props) throws ServiceException 84 { 85 throw new NotImplementedException(); 86 } 87 88 95 public Service createService(QName serviceName) throws ServiceException 96 { 97 return new ServiceImpl(serviceName); 98 } 99 100 109 public Service createService(URL wsdlDocumentLocation, QName serviceName) throws ServiceException 110 { 111 ServiceImpl service = new ServiceImpl(wsdlDocumentLocation, serviceName); 112 113 try 114 { 115 WSDL11DefinitionFactory factory = WSDL11DefinitionFactory.newInstance(); 116 Definition wsdlDefinition = factory.parse(wsdlDocumentLocation); 117 118 ServiceDescription serviceDesc = new ServiceDescription(wsdlDefinition, null, null, null); 120 service.initService(serviceDesc, null); 121 } 122 catch (Exception e) 123 { 124 throw new ServiceException (e); 125 } 126 127 return service; 128 } 129 130 144 public Service createService(URL wsdlLocation, URL mappingLocation, URL ws4eeMetaData, QName serviceName, String portName) throws ServiceException 145 { 146 ServiceImpl service = new ServiceImpl(wsdlLocation, serviceName); 147 148 try 149 { 150 WSDL11DefinitionFactory wsdlFactory = WSDL11DefinitionFactory.newInstance(); 151 Definition wsdlDefinition = wsdlFactory.parse(wsdlLocation); 152 153 JavaWsdlMapping javaWsdlMapping = null; 154 if (mappingLocation != null) 155 { 156 JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance(); 157 javaWsdlMapping = mappingFactory.parse(mappingLocation); 158 } 159 160 ServiceDescription serviceDesc = new ServiceDescription(wsdlDefinition, javaWsdlMapping, ws4eeMetaData, portName); 161 service.initService(serviceDesc, portName); 162 } 163 catch (Exception e) 164 { 165 log.error(e.getMessage(), e); 166 throw new ServiceException (e); 167 } 168 169 return service; 170 } 171 } 172 | Popular Tags |