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