1 17 package org.apache.geronimo.axis.builder; 18 19 import java.lang.reflect.Method ; 20 import java.net.MalformedURLException ; 21 import java.net.URI ; 22 import java.net.URISyntaxException ; 23 import java.net.URL ; 24 import java.util.ArrayList ; 25 import java.util.Collection ; 26 import java.util.Collections ; 27 import java.util.HashMap ; 28 import java.util.HashSet ; 29 import java.util.Iterator ; 30 import java.util.List ; 31 import java.util.Map ; 32 import java.util.Set ; 33 import java.util.jar.JarFile ; 34 35 import javax.wsdl.Binding; 36 import javax.wsdl.BindingOperation; 37 import javax.wsdl.Definition; 38 import javax.wsdl.Operation; 39 import javax.wsdl.Port; 40 import javax.wsdl.PortType; 41 import javax.wsdl.extensions.soap.SOAPAddress; 42 import javax.wsdl.extensions.soap.SOAPBinding; 43 import javax.xml.namespace.QName ; 44 import javax.xml.rpc.handler.HandlerInfo ; 45 46 import org.apache.axis.constants.Style; 47 import org.apache.axis.description.JavaServiceDesc; 48 import org.apache.axis.handlers.HandlerInfoChainFactory; 49 import org.apache.axis.handlers.soap.SOAPService; 50 import org.apache.axis.providers.java.RPCProvider; 51 import org.apache.axis.soap.SOAPConstants; 52 import org.apache.geronimo.axis.client.AxisServiceReference; 53 import org.apache.geronimo.axis.client.OperationInfo; 54 import org.apache.geronimo.axis.client.SEIFactory; 55 import org.apache.geronimo.axis.client.SEIFactoryImpl; 56 import org.apache.geronimo.axis.server.AxisWebServiceContainer; 57 import org.apache.geronimo.axis.server.POJOProvider; 58 import org.apache.geronimo.axis.server.ServiceInfo; 59 import org.apache.geronimo.common.DeploymentException; 60 import org.apache.geronimo.gbean.GBeanData; 61 import org.apache.geronimo.gbean.GBeanInfo; 62 import org.apache.geronimo.gbean.GBeanInfoBuilder; 63 import org.apache.geronimo.gbean.AbstractName; 64 import org.apache.geronimo.j2ee.deployment.Module; 65 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder; 66 import org.apache.geronimo.j2ee.deployment.HandlerInfoInfo; 67 import org.apache.geronimo.j2ee.deployment.WebModule; 68 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 69 import org.apache.geronimo.xbeans.geronimo.naming.GerPortCompletionType; 70 import org.apache.geronimo.xbeans.geronimo.naming.GerPortType; 71 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceCompletionType; 72 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType; 73 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType; 74 import org.apache.geronimo.xbeans.j2ee.JavaXmlTypeMappingType; 75 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointInterfaceMappingType; 76 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType; 77 import org.apache.geronimo.deployment.util.DeploymentUtil; 78 import org.apache.geronimo.deployment.DeploymentContext; 79 import org.apache.geronimo.deployment.service.EnvironmentBuilder; 80 import org.apache.geronimo.webservices.SerializableWebServiceContainerFactoryGBean; 81 import org.apache.geronimo.webservices.builder.PortInfo; 82 import org.apache.geronimo.webservices.builder.SchemaInfoBuilder; 83 import org.apache.geronimo.webservices.builder.WSDescriptorParser; 84 import org.apache.geronimo.kernel.GBeanAlreadyExistsException; 85 import org.apache.geronimo.kernel.repository.Environment; 86 87 90 public class AxisBuilder implements WebServiceBuilder { 91 92 private static final SOAPConstants SOAP_VERSION = SOAPConstants.SOAP11_CONSTANTS; 93 94 private final Environment defaultEnvironment; 95 private static final String KEY = AxisBuilder.class.getName(); 96 97 public AxisBuilder() { 98 defaultEnvironment = null; 99 } 100 101 public AxisBuilder(Environment defaultEnvironment) { 102 this.defaultEnvironment = defaultEnvironment; 103 } 104 105 106 public void findWebServices(JarFile moduleFile, boolean isEJB, Map servletLocations, Environment environment, Map sharedContext) throws DeploymentException { 107 final String path = isEJB ? "META-INF/webservices.xml" : "WEB-INF/webservices.xml"; 108 try { 109 URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, path); 110 Map portMap = WSDescriptorParser.parseWebServiceDescriptor(wsDDUrl, moduleFile, isEJB, servletLocations); 111 if (portMap != null) { 112 if (defaultEnvironment != null) { 113 EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment); 114 } 115 sharedContext.put(KEY, portMap); 116 } 117 } catch (MalformedURLException e) { 118 } 120 } 121 122 public boolean configurePOJO(GBeanData targetGBean, String servletName, Module module, String seiClassName, DeploymentContext context) throws DeploymentException { 123 ClassLoader cl = context.getClassLoader(); 124 Map sharedContext = ((WebModule) module).getSharedContext(); 125 Map portInfoMap = (Map ) sharedContext.get(KEY); 126 PortInfo portInfo = (PortInfo) portInfoMap.get(servletName); 127 if (portInfo == null) { 128 return false; 130 } 131 ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(portInfo, cl); 132 JavaServiceDesc serviceDesc = serviceInfo.getServiceDesc(); 133 134 targetGBean.setAttribute("pojoClassName", seiClassName); 135 RPCProvider provider = new POJOProvider(); 136 137 SOAPService service = new SOAPService(null, provider, null); 138 service.setServiceDescription(serviceDesc); 139 service.setOption("className", seiClassName); 140 141 HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(serviceInfo.getHandlerInfos()); 142 service.setOption(org.apache.axis.Constants.ATTR_HANDLERINFOCHAIN, handlerInfoChainFactory); 143 144 URI location; 145 try { 146 location = new URI (serviceDesc.getEndpointURL()); 147 } catch (URISyntaxException e) { 148 throw new DeploymentException("Invalid webservice endpoint URI", e); 149 } 150 URI wsdlURI; 151 try { 152 wsdlURI = new URI (serviceDesc.getWSDLFile()); 153 } catch (URISyntaxException e) { 154 throw new DeploymentException("Invalid wsdl URI", e); 155 156 } 157 158 AxisWebServiceContainer axisWebServiceContainer = new AxisWebServiceContainer(location, wsdlURI, service, serviceInfo.getWsdlMap(), cl); 159 AbstractName webServiceContainerFactoryName = context.getNaming().createChildName(targetGBean.getAbstractName(), "webServiceContainer", NameFactory.GERONIMO_SERVICE); 160 GBeanData webServiceContainerFactoryGBean = new GBeanData(webServiceContainerFactoryName, SerializableWebServiceContainerFactoryGBean.GBEAN_INFO); 161 webServiceContainerFactoryGBean.setAttribute("webServiceContainer", axisWebServiceContainer); 162 try { 163 context.addGBean(webServiceContainerFactoryGBean); 164 } catch (GBeanAlreadyExistsException e) { 165 throw new DeploymentException("Could not add webServiceContainerFactoryGBean", e); 166 } 167 targetGBean.setReferencePattern("WebServiceContainerFactory", webServiceContainerFactoryName); 168 return true; 169 } 170 171 public boolean configureEJB(GBeanData targetGBean, String ejbName, JarFile moduleFile, Map sharedContext, ClassLoader classLoader) throws DeploymentException { 172 Map portInfoMap = (Map ) sharedContext.get(KEY); 173 PortInfo portInfo = (PortInfo) portInfoMap.get(ejbName); 174 if (portInfo == null) { 175 return false; 177 } 178 ServiceInfo serviceInfo = AxisServiceBuilder.createServiceInfo(portInfo, classLoader); 179 targetGBean.setAttribute("serviceInfo", serviceInfo); 180 JavaServiceDesc serviceDesc = serviceInfo.getServiceDesc(); 181 URI location = portInfo.getContextURI(); 182 targetGBean.setAttribute("location", location); 183 URI wsdlURI; 184 try { 185 wsdlURI = new URI (serviceDesc.getWSDLFile()); 186 } catch (URISyntaxException e) { 187 throw new DeploymentException("Invalid wsdl URI", e); 188 } 189 targetGBean.setAttribute("wsdlURI", wsdlURI); 190 return true; 191 } 192 193 194 public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, Module module, ClassLoader classLoader) throws DeploymentException { 196 GerServiceRefType gerServiceRefType = (GerServiceRefType) serviceRefType; 197 JarFile moduleFile = module.getModuleFile(); 198 SchemaInfoBuilder schemaInfoBuilder = null; 199 JavaWsdlMappingType mapping = null; 200 if (wsdlURI != null) { 201 schemaInfoBuilder = new SchemaInfoBuilder(moduleFile, wsdlURI); 202 203 mapping = WSDescriptorParser.readJaxrpcMapping(moduleFile, jaxrpcMappingURI); 204 } 205 206 return createService(serviceInterface, schemaInfoBuilder, mapping, serviceQName, SOAP_VERSION, handlerInfos, gerServiceRefType, module, classLoader); 207 } 208 209 public Object createService(Class serviceInterface, SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, List handlerInfos, GerServiceRefType serviceRefType, Module module, ClassLoader classloader) throws DeploymentException { 210 Map seiPortNameToFactoryMap = new HashMap (); 211 Map seiClassNameToFactoryMap = new HashMap (); 212 if (schemaInfoBuilder != null) { 213 buildSEIFactoryMap(schemaInfoBuilder, serviceRefType, mapping, handlerInfos, serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap, classloader); 214 } 215 return new AxisServiceReference(serviceInterface.getName(), seiPortNameToFactoryMap, seiClassNameToFactoryMap); 216 } 217 218 public void buildSEIFactoryMap(SchemaInfoBuilder schemaInfoBuilder, GerServiceRefType serviceRefType, JavaWsdlMappingType mapping, List handlerInfos, QName serviceQName, SOAPConstants soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, ClassLoader classLoader) throws DeploymentException { 219 Map exceptionMap = WSDescriptorParser.getExceptionMap(mapping); 220 221 Definition definition = schemaInfoBuilder.getDefinition(); 222 if (definition.getServices().size() == 0) { 224 if (serviceRefType == null || !serviceRefType.isSetServiceCompletion()) { 226 throw new DeploymentException("Partial wsdl, but no service completion supplied"); 227 } 228 GerServiceCompletionType serviceCompletion = serviceRefType.getServiceCompletion(); 229 String serviceLocalName = serviceCompletion.getServiceName().trim(); 230 String namespace = definition.getTargetNamespace(); 231 serviceQName = new QName (namespace, serviceLocalName); 232 javax.wsdl.Service service = definition.createService(); 233 service.setQName(serviceQName); 234 GerPortCompletionType[] portCompletions = serviceCompletion.getPortCompletionArray(); 235 for (int i = 0; i < portCompletions.length; i++) { 236 GerPortCompletionType portCompletion = portCompletions[i]; 237 GerPortType port = portCompletion.getPort(); 238 URL location = getLocation(port); 239 String portName = port.getPortName().trim(); 240 String bindingName = portCompletion.getBindingName().trim(); 241 QName bindingQName = new QName (namespace, bindingName); 242 Binding binding = definition.getBinding(bindingQName); 243 if (binding == null) { 244 throw new DeploymentException("No binding found with qname: " + bindingQName); 245 } 246 String credentialsName = port.isSetCredentialsName() ? port.getCredentialsName().trim() : null; 247 mapBinding(binding, mapping, serviceQName, classLoader, soapVersion, schemaInfoBuilder, portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName, exceptionMap); 248 249 } 250 } else { 251 if (serviceRefType != null && serviceRefType.isSetServiceCompletion()) { 253 throw new DeploymentException("Full wsdl, but service completion supplied"); 254 } 255 Map portMap = new HashMap (); 257 if (serviceRefType != null) { 258 GerPortType[] ports = serviceRefType.getPortArray(); 259 for (int i = 0; i < ports.length; i++) { 260 GerPortType port = ports[i]; 261 String portName = port.getPortName().trim(); 262 portMap.put(portName, port); 263 } 264 } 265 266 javax.wsdl.Service service = getService(serviceQName, schemaInfoBuilder.getDefinition()); 268 if (serviceQName == null) { 269 serviceQName = service.getQName(); 270 } 271 272 Map wsdlPortMap = service.getPorts(); 273 for (Iterator iterator = wsdlPortMap.entrySet().iterator(); iterator.hasNext();) { 274 Map.Entry entry = (Map.Entry ) iterator.next(); 275 String portName = (String ) entry.getKey(); 276 Port port = (Port) entry.getValue(); 277 278 GerPortType gerPort = (GerPortType) portMap.get(portName); 279 280 URL location = gerPort == null ? getAddressLocation(port) : getLocation(gerPort); 281 if (location == null) { 283 continue; 284 } 285 String credentialsName = gerPort == null || gerPort.getCredentialsName() == null ? null : gerPort.getCredentialsName().trim(); 286 287 Binding binding = port.getBinding(); 288 289 mapBinding(binding, mapping, serviceQName, classLoader, soapVersion, schemaInfoBuilder, portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName, exceptionMap); 290 } 291 } 292 } 293 294 private void mapBinding(Binding binding, JavaWsdlMappingType mapping, QName serviceQName, ClassLoader classLoader, SOAPConstants soapVersion, SchemaInfoBuilder schemaInfoBuilder, String portName, URL location, List handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, String credentialsName, Map exceptionMap) throws DeploymentException { 295 Style portStyle = getStyle(binding); 296 297 PortType portType = binding.getPortType(); 298 299 ServiceEndpointInterfaceMappingType[] endpointMappings = mapping.getServiceEndpointInterfaceMappingArray(); 300 301 List operations = portType.getOperations(); 303 OperationInfo[] operationInfos = new OperationInfo[operations.size()]; 304 if (endpointMappings.length == 0) { 305 doLightweightMapping(serviceQName, portType, mapping, classLoader, operations, binding, portStyle, soapVersion, operationInfos, schemaInfoBuilder, portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName); 306 } else { 307 doHeavyweightMapping(serviceQName, portType, endpointMappings, classLoader, operations, binding, portStyle, soapVersion, exceptionMap, schemaInfoBuilder, mapping, operationInfos, portName, location, handlerInfos, seiPortNameToFactoryMap, seiClassNameToFactoryMap, credentialsName); 308 } 309 } 310 311 private URL getLocation(GerPortType port) throws DeploymentException { 312 String protocol = port.getProtocol().trim(); 313 String host = port.getHost().trim(); 314 int portNum = port.getPort(); 315 String uri = port.getUri().trim(); 316 String locationURIString = protocol + "://" + host + ":" + portNum + uri; 317 URL location; 318 try { 319 location = new URL (locationURIString); 320 } catch (MalformedURLException e) { 321 throw new DeploymentException("Could not construct web service location URL from " + locationURIString); 322 } 323 return location; 324 } 325 326 private javax.wsdl.Service getService(QName serviceQName, Definition definition) throws DeploymentException { 327 javax.wsdl.Service service; 328 if (serviceQName != null) { 329 service = definition.getService(serviceQName); 330 if (service == null) { 331 throw new DeploymentException("No service wsdl for supplied service qname " + serviceQName); 332 } 333 } else { 334 Map services = definition.getServices(); 335 if (services.size() > 1) { 336 throw new DeploymentException("no serviceQName supplied, and there are " + services.size() + " services"); 337 } 338 if (services.size() == 0) { 339 throw new DeploymentException("No service in wsdl, and no service completion supplied!"); 340 } else { 341 service = (javax.wsdl.Service) services.values().iterator().next(); 342 } 343 } 344 return service; 345 } 346 347 private Style getStyle(Binding binding) throws DeploymentException { 348 SOAPBinding soapBinding = (SOAPBinding) SchemaInfoBuilder.getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements()); 349 String portStyleString = soapBinding.getStyle(); 351 return Style.getStyle(portStyleString); 352 } 353 354 private URL getAddressLocation(Port port) throws DeploymentException { 355 SOAPAddress soapAddress; 356 try { 357 soapAddress = (SOAPAddress) SchemaInfoBuilder.getExtensibilityElement(SOAPAddress.class, port.getExtensibilityElements()); 358 } catch (DeploymentException e) { 359 return null; 361 } 362 String locationURIString = soapAddress.getLocationURI(); 363 URL location; 364 try { 365 location = new URL (locationURIString); 366 } catch (MalformedURLException e) { 367 throw new DeploymentException("Could not construct web service location URL from " + locationURIString); 368 } 369 return location; 370 } 371 372 private void doHeavyweightMapping(QName serviceName, PortType portType, ServiceEndpointInterfaceMappingType[] endpointMappings, ClassLoader classLoader, List operations, Binding binding, Style portStyle, SOAPConstants soapVersion, Map exceptionMap, SchemaInfoBuilder schemaInfoBuilder, JavaWsdlMappingType mapping, OperationInfo[] operationInfos, String portName, URL location, List handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, String credentialsName) throws DeploymentException { 373 Class serviceEndpointInterface; 374 SEIFactory seiFactory; 375 QName portTypeQName = portType.getQName(); 377 ServiceEndpointInterfaceMappingType endpointMapping = WSDescriptorParser.getServiceEndpointInterfaceMapping(endpointMappings, portTypeQName); 378 String fqcn = endpointMapping.getServiceEndpointInterface().getStringValue(); 379 try { 380 serviceEndpointInterface = classLoader.loadClass(fqcn); 381 } catch (ClassNotFoundException e) { 382 throw new DeploymentException("Could not load service endpoint interface", e); 383 } 384 386 Collection operationDescs = new ArrayList (); 387 ServiceEndpointMethodMappingType[] methodMappings = endpointMapping.getServiceEndpointMethodMappingArray(); 388 int i = 0; 389 Set wrapperElementQNames = new HashSet (); 390 JavaXmlTypeMappingType[] javaXmlTypeMappings = mapping.getJavaXmlTypeMappingArray(); 391 boolean hasEncoded = false; 392 for (Iterator ops = operations.iterator(); ops.hasNext();) { 393 Operation operation = (Operation) ops.next(); 394 String operationName = operation.getName(); 395 BindingOperation bindingOperation = null; 398 List bops = binding.getBindingOperations(); 399 for (Iterator iterator = bops.iterator(); iterator.hasNext();) { 400 BindingOperation bindingOperation1 = (BindingOperation) iterator.next(); 401 if (bindingOperation1.getOperation().equals(operation)) { 402 bindingOperation = bindingOperation1; 403 break; 404 } 405 } 406 if (bindingOperation == null) { 407 throw new DeploymentException("No BindingOperation for operation: " + operationName + ", input: " + operation.getInput().getName() + ", output: " + (operation.getOutput() == null ? "<none>" : operation.getOutput().getName())); 408 } 409 ServiceEndpointMethodMappingType methodMapping = WSDescriptorParser.getMethodMappingForOperation(operationName, methodMappings); 410 HeavyweightOperationDescBuilder operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation, mapping, methodMapping, portStyle, exceptionMap, schemaInfoBuilder, javaXmlTypeMappings, classLoader, serviceEndpointInterface); 411 OperationInfo operationInfo = operationDescBuilder.buildOperationInfo(soapVersion); 412 operationInfos[i++] = operationInfo; 413 operationDescs.add(operationInfo.getOperationDesc()); 414 wrapperElementQNames.addAll(operationDescBuilder.getWrapperElementQNames()); 415 hasEncoded |= operationDescBuilder.isEncoded(); 416 } 417 HeavyweightTypeInfoBuilder builder = new HeavyweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), wrapperElementQNames, operationDescs, hasEncoded); 418 List typeInfo = builder.buildTypeInfo(mapping); 419 420 seiFactory = createSEIFactory(serviceName, portName, serviceEndpointInterface.getName(), typeInfo, location, operationInfos, handlerInfos, credentialsName); 421 seiPortNameToFactoryMap.put(portName, seiFactory); 422 seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory); 423 } 424 425 private void doLightweightMapping(QName serviceName, PortType portType, JavaWsdlMappingType mapping, ClassLoader classLoader, List operations, Binding binding, Style portStyle, SOAPConstants soapVersion, OperationInfo[] operationInfos, SchemaInfoBuilder schemaInfoBuilder, String portName, URL location, List handlerInfos, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, String credentialsName) throws DeploymentException { 426 Class serviceEndpointInterface; 427 SEIFactory seiFactory; 428 serviceEndpointInterface = getServiceEndpointInterfaceLightweight(portType, mapping, classLoader); 430 432 int i = 0; 433 for (Iterator ops = operations.iterator(); ops.hasNext();) { 434 Operation operation = (Operation) ops.next(); 435 Method method = WSDescriptorParser.getMethodForOperation(serviceEndpointInterface, operation); 436 BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(), operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName()); 437 operationInfos[i++] = buildOperationInfoLightweight(method, bindingOperation, portStyle, soapVersion); 438 } 439 LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), Collections.EMPTY_SET); 440 List typeInfo = builder.buildTypeInfo(mapping); 441 442 seiFactory = createSEIFactory(serviceName, portName, serviceEndpointInterface.getName(), typeInfo, location, operationInfos, handlerInfos, credentialsName); 443 seiPortNameToFactoryMap.put(portName, seiFactory); 444 seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory); 445 } 446 447 private Class getServiceEndpointInterfaceLightweight(PortType portType, JavaWsdlMappingType mappings, ClassLoader classLoader) throws DeploymentException { 448 QName portTypeQName = portType.getQName(); 449 String portTypeNamespace = portTypeQName.getNamespaceURI(); 450 String portTypePackage = WSDescriptorParser.getPackageFromNamespace(portTypeNamespace, mappings); 451 StringBuffer shortInterfaceName = new StringBuffer (portTypeQName.getLocalPart()); 452 shortInterfaceName.setCharAt(0, Character.toUpperCase(shortInterfaceName.charAt(0))); 453 String fqcn = portTypePackage + "." + shortInterfaceName.toString(); 455 try { 456 return classLoader.loadClass(fqcn); 457 } catch (ClassNotFoundException e) { 458 throw new DeploymentException("Could not load service endpoint interface type", e); 459 } 460 } 461 462 463 public SEIFactory createSEIFactory(QName serviceName, String portName, String enhancedServiceEndpointClassName, List typeInfo, URL location, OperationInfo[] operationInfos, List handlerInfoInfos, String credentialsName) throws DeploymentException { 464 List handlerInfos = buildHandlerInfosForPort(portName, handlerInfoInfos); 465 return new SEIFactoryImpl(serviceName, portName, enhancedServiceEndpointClassName, operationInfos, typeInfo, location, handlerInfos, credentialsName); 466 } 467 468 private List buildHandlerInfosForPort(String portName, List handlerInfoInfos) { 469 List handlerInfos = new ArrayList (); 470 for (Iterator iterator = handlerInfoInfos.iterator(); iterator.hasNext();) { 471 HandlerInfoInfo handlerInfoInfo = (HandlerInfoInfo) iterator.next(); 472 Set portNames = handlerInfoInfo.getPortNames(); 473 if (portNames.isEmpty() || portNames.contains(portName)) { 474 HandlerInfo handlerInfo = new HandlerInfo (handlerInfoInfo.getHandlerClass(), handlerInfoInfo.getHandlerConfig(), handlerInfoInfo.getSoapHeaders()); 475 handlerInfos.add(handlerInfo); 476 477 } 479 } 480 return handlerInfos; 481 } 482 483 public OperationInfo buildOperationInfoLightweight(Method method, BindingOperation bindingOperation, Style defaultStyle, SOAPConstants soapVersion) throws DeploymentException { 484 LightweightOperationDescBuilder operationDescBuilder = new LightweightOperationDescBuilder(bindingOperation, method); 485 return operationDescBuilder.buildOperationInfo(soapVersion); 486 } 487 488 489 public static final GBeanInfo GBEAN_INFO; 490 491 static { 492 GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(AxisBuilder.class, NameFactory.MODULE_BUILDER); 493 infoBuilder.addInterface(WebServiceBuilder.class); 494 infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true); 495 496 infoBuilder.setConstructor(new String []{"defaultEnvironment"}); 497 498 GBEAN_INFO = infoBuilder.getBeanInfo(); 499 } 500 501 public static GBeanInfo getGBeanInfo() { 502 return GBEAN_INFO; 503 } 504 505 } 506 | Popular Tags |