1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.transport.soap.axis; |
12 | |
|
13 | |
import org.mule.api.MuleContext; |
14 | |
import org.mule.api.MuleException; |
15 | |
import org.mule.api.construct.FlowConstruct; |
16 | |
import org.mule.api.context.notification.MuleContextNotificationListener; |
17 | |
import org.mule.api.endpoint.EndpointBuilder; |
18 | |
import org.mule.api.endpoint.EndpointURI; |
19 | |
import org.mule.api.endpoint.ImmutableEndpoint; |
20 | |
import org.mule.api.endpoint.InboundEndpoint; |
21 | |
import org.mule.api.lifecycle.InitialisationException; |
22 | |
import org.mule.api.processor.MessageProcessor; |
23 | |
import org.mule.api.security.EndpointSecurityFilter; |
24 | |
import org.mule.api.service.Service; |
25 | |
import org.mule.api.source.CompositeMessageSource; |
26 | |
import org.mule.api.transport.MessageReceiver; |
27 | |
import org.mule.component.DefaultJavaComponent; |
28 | |
import org.mule.config.ExceptionHelper; |
29 | |
import org.mule.config.i18n.CoreMessages; |
30 | |
import org.mule.context.notification.MuleContextNotification; |
31 | |
import org.mule.endpoint.AbstractEndpointBuilder; |
32 | |
import org.mule.endpoint.EndpointURIEndpointBuilder; |
33 | |
import org.mule.model.seda.SedaService; |
34 | |
import org.mule.object.SingletonObjectFactory; |
35 | |
import org.mule.processor.SecurityFilterMessageProcessor; |
36 | |
import org.mule.routing.MessageFilter; |
37 | |
import org.mule.service.ServiceCompositeMessageSource; |
38 | |
import org.mule.transport.AbstractConnector; |
39 | |
import org.mule.transport.service.TransportFactory; |
40 | |
import org.mule.transport.servlet.ServletConnector; |
41 | |
import org.mule.transport.soap.axis.extensions.MuleConfigProvider; |
42 | |
import org.mule.transport.soap.axis.extensions.MuleTransport; |
43 | |
import org.mule.transport.soap.axis.extensions.WSDDFileProvider; |
44 | |
import org.mule.transport.soap.axis.extensions.WSDDJavaMuleProvider; |
45 | |
import org.mule.transport.soap.axis.i18n.AxisMessages; |
46 | |
import org.mule.util.ClassUtils; |
47 | |
import org.mule.util.CollectionUtils; |
48 | |
import org.mule.util.MuleUrlStreamHandlerFactory; |
49 | |
|
50 | |
import java.util.ArrayList; |
51 | |
import java.util.HashMap; |
52 | |
import java.util.Iterator; |
53 | |
import java.util.List; |
54 | |
import java.util.Map; |
55 | |
|
56 | |
import javax.xml.namespace.QName; |
57 | |
|
58 | |
import org.apache.axis.client.Call; |
59 | |
import org.apache.axis.configuration.SimpleProvider; |
60 | |
import org.apache.axis.deployment.wsdd.WSDDConstants; |
61 | |
import org.apache.axis.deployment.wsdd.WSDDProvider; |
62 | |
import org.apache.axis.encoding.TypeMappingRegistryImpl; |
63 | |
import org.apache.axis.encoding.ser.BeanDeserializerFactory; |
64 | |
import org.apache.axis.encoding.ser.BeanSerializerFactory; |
65 | |
import org.apache.axis.handlers.soap.SOAPService; |
66 | |
import org.apache.axis.server.AxisServer; |
67 | |
import org.apache.axis.wsdl.fromJava.Namespaces; |
68 | |
import org.apache.axis.wsdl.fromJava.Types; |
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | 0 | public class AxisConnector extends AbstractConnector implements MuleContextNotificationListener<MuleContextNotification> |
78 | |
{ |
79 | |
|
80 | |
static |
81 | |
{ |
82 | 0 | ExceptionHelper.registerExceptionReader(new AxisFaultExceptionReader()); |
83 | |
} |
84 | |
|
85 | 0 | public static final QName QNAME_MULE_PROVIDER = new QName(WSDDConstants.URI_WSDD_JAVA, "Mule"); |
86 | 0 | public static final QName QNAME_MULE_TYPE_MAPPINGS = new QName("http://www.muleumo.org/ws/mappings", |
87 | |
"Mule"); |
88 | |
public static final String DEFAULT_MULE_NAMESPACE_URI = "http://www.muleumo.org"; |
89 | |
|
90 | |
public static final String DEFAULT_MULE_AXIS_SERVER_CONFIG = "mule-axis-server-config.wsdd"; |
91 | |
public static final String DEFAULT_MULE_AXIS_CLIENT_CONFIG = "mule-axis-client-config.wsdd"; |
92 | |
public static final String AXIS_SERVICE_COMPONENT_NAME = "_axisServiceComponent"; |
93 | |
public static final String AXIS_SERVICE_PROPERTY = "_axisService"; |
94 | |
public static final String AXIS_CLIENT_CONFIG_PROPERTY = "clientConfig"; |
95 | |
|
96 | |
public static final String SERVICE_PROPERTY_COMPONENT_NAME = "componentName"; |
97 | |
public static final String SERVICE_PROPERTY_SERVCE_PATH = "servicePath"; |
98 | |
|
99 | |
public static final String AXIS = "axis"; |
100 | |
|
101 | |
|
102 | |
public static final String SOAP_METHODS = "soapMethods"; |
103 | |
public static final String STYLE = "style"; |
104 | |
public static final String USE = "use"; |
105 | |
|
106 | 0 | private String serverConfig = DEFAULT_MULE_AXIS_SERVER_CONFIG; |
107 | |
|
108 | 0 | private AxisServer axis = null; |
109 | 0 | private SimpleProvider serverProvider = null; |
110 | 0 | private String clientConfig = DEFAULT_MULE_AXIS_CLIENT_CONFIG; |
111 | 0 | private SimpleProvider clientProvider = null; |
112 | |
|
113 | |
private List beanTypes; |
114 | |
private Service axisComponent; |
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | 0 | private Map axisTransportProtocols = null; |
125 | |
|
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | 0 | private List servletServices = new ArrayList(); |
133 | |
|
134 | 0 | private List supportedSchemes = null; |
135 | |
|
136 | 0 | private boolean doAutoTypes = true; |
137 | |
|
138 | 0 | private boolean treatMapAsNamedParams = true; |
139 | |
|
140 | |
public AxisConnector(MuleContext context) |
141 | |
{ |
142 | 0 | super(context); |
143 | 0 | this.registerProtocols(); |
144 | 0 | } |
145 | |
|
146 | |
protected void registerProtocols() |
147 | |
{ |
148 | 0 | if (supportedSchemes == null) |
149 | |
{ |
150 | |
|
151 | |
|
152 | 0 | supportedSchemes = new ArrayList(); |
153 | 0 | supportedSchemes.add("http"); |
154 | 0 | supportedSchemes.add("https"); |
155 | 0 | supportedSchemes.add("servlet"); |
156 | 0 | supportedSchemes.add("vm"); |
157 | 0 | supportedSchemes.add("jms"); |
158 | 0 | supportedSchemes.add("xmpp"); |
159 | 0 | supportedSchemes.add("ssl"); |
160 | 0 | supportedSchemes.add("tcp"); |
161 | 0 | supportedSchemes.add("smtp"); |
162 | 0 | supportedSchemes.add("smtps"); |
163 | 0 | supportedSchemes.add("pop3"); |
164 | 0 | supportedSchemes.add("pop3s"); |
165 | 0 | supportedSchemes.add("imap"); |
166 | 0 | supportedSchemes.add("imaps"); |
167 | |
} |
168 | |
|
169 | 0 | for (Iterator iterator = supportedSchemes.iterator(); iterator.hasNext();) |
170 | |
{ |
171 | 0 | String s = (String) iterator.next(); |
172 | 0 | registerSupportedProtocol(s); |
173 | 0 | } |
174 | 0 | } |
175 | |
|
176 | |
@Override |
177 | |
protected void doInitialise() throws InitialisationException |
178 | |
{ |
179 | 0 | axisTransportProtocols = new HashMap(); |
180 | |
|
181 | |
|
182 | 0 | axisTransportProtocols = new HashMap(); |
183 | |
try |
184 | |
{ |
185 | 0 | for (Iterator iterator = supportedSchemes.iterator(); iterator.hasNext();) |
186 | |
{ |
187 | 0 | String s = (String) iterator.next(); |
188 | 0 | axisTransportProtocols.put(s, MuleTransport.getTransportClass(s)); |
189 | 0 | registerSupportedProtocol(s); |
190 | 0 | } |
191 | 0 | muleContext.registerListener(this); |
192 | |
} |
193 | 0 | catch (Exception e) |
194 | |
{ |
195 | 0 | throw new InitialisationException(e, this); |
196 | 0 | } |
197 | |
|
198 | |
|
199 | 0 | if (clientProvider == null) |
200 | |
{ |
201 | 0 | clientProvider = createAxisProvider(clientConfig); |
202 | |
} |
203 | |
else |
204 | |
{ |
205 | 0 | if (!DEFAULT_MULE_AXIS_CLIENT_CONFIG.equals(clientConfig)) |
206 | |
{ |
207 | 0 | logger.warn(AxisMessages.clientProviderAndClientConfigConfigured()); |
208 | |
} |
209 | |
} |
210 | |
|
211 | 0 | if (axis == null) |
212 | |
{ |
213 | 0 | if (serverProvider == null) |
214 | |
{ |
215 | 0 | serverProvider = this.createAxisProvider(serverConfig); |
216 | |
} |
217 | |
else |
218 | |
{ |
219 | 0 | if (!DEFAULT_MULE_AXIS_SERVER_CONFIG.equals(serverConfig)) |
220 | |
{ |
221 | 0 | logger.warn(AxisMessages.serverProviderAndServerConfigConfigured()); |
222 | |
} |
223 | |
} |
224 | |
|
225 | |
|
226 | 0 | axis = new AxisServer(serverProvider); |
227 | |
|
228 | 0 | axis.setOption("axis.doAutoTypes", Boolean.valueOf(doAutoTypes)); |
229 | |
} |
230 | |
|
231 | |
|
232 | 0 | WSDDProvider.registerProvider(QNAME_MULE_PROVIDER, new WSDDJavaMuleProvider(this)); |
233 | |
|
234 | |
try |
235 | |
{ |
236 | 0 | registerTransportTypes(); |
237 | |
} |
238 | 0 | catch (ClassNotFoundException e) |
239 | |
{ |
240 | 0 | throw new InitialisationException( |
241 | |
CoreMessages.cannotLoadFromClasspath(e.getMessage()), e, this); |
242 | 0 | } |
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | 0 | MuleUrlStreamHandlerFactory.registerHandler("jms", new org.mule.transport.soap.axis.transport.jms.Handler()); |
248 | 0 | MuleUrlStreamHandlerFactory.registerHandler("pop3", new org.mule.transport.soap.axis.transport.pop3.Handler()); |
249 | 0 | MuleUrlStreamHandlerFactory.registerHandler("smtp", new org.mule.transport.soap.axis.transport.smtp.Handler()); |
250 | 0 | MuleUrlStreamHandlerFactory.registerHandler("vm", new org.mule.transport.soap.axis.transport.vm.Handler()); |
251 | |
|
252 | |
try |
253 | |
{ |
254 | 0 | registerTypes((TypeMappingRegistryImpl) axis.getTypeMappingRegistry(), beanTypes); |
255 | |
} |
256 | 0 | catch (ClassNotFoundException e) |
257 | |
{ |
258 | 0 | throw new InitialisationException(e, this); |
259 | 0 | } |
260 | 0 | } |
261 | |
|
262 | |
protected void registerTransportTypes() throws ClassNotFoundException |
263 | |
{ |
264 | |
|
265 | |
|
266 | |
|
267 | 0 | for (Iterator iterator = getAxisTransportProtocols().keySet().iterator(); iterator.hasNext();) |
268 | |
{ |
269 | 0 | String protocol = (String) iterator.next(); |
270 | 0 | Object temp = getAxisTransportProtocols().get(protocol); |
271 | |
Class clazz; |
272 | 0 | if (temp instanceof String) |
273 | |
{ |
274 | 0 | clazz = ClassUtils.loadClass(temp.toString(), getClass()); |
275 | |
} |
276 | |
else |
277 | |
{ |
278 | 0 | clazz = (Class) temp; |
279 | |
} |
280 | 0 | Call.setTransportForProtocol(protocol, clazz); |
281 | 0 | } |
282 | 0 | } |
283 | |
|
284 | |
protected SimpleProvider createAxisProvider(String config) throws InitialisationException |
285 | |
{ |
286 | |
|
287 | |
|
288 | |
|
289 | |
|
290 | 0 | WSDDFileProvider fileProvider = new WSDDFileProvider(config); |
291 | 0 | fileProvider.setSearchClasspath(true); |
292 | |
|
293 | |
|
294 | |
|
295 | |
|
296 | |
|
297 | 0 | return new MuleConfigProvider(fileProvider); |
298 | |
} |
299 | |
|
300 | |
public String getProtocol() |
301 | |
{ |
302 | 0 | return AXIS; |
303 | |
} |
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
@Override |
314 | |
protected Object getReceiverKey(FlowConstruct flowConstruct, InboundEndpoint endpoint) |
315 | |
{ |
316 | 0 | if (endpoint.getEndpointURI().getPort() == -1) |
317 | |
{ |
318 | 0 | return flowConstruct.getName(); |
319 | |
} |
320 | |
else |
321 | |
{ |
322 | 0 | return endpoint.getEndpointURI().getAddress() + "/" + flowConstruct.getName(); |
323 | |
} |
324 | |
} |
325 | |
|
326 | |
protected void unregisterReceiverWithMuleService(MessageReceiver receiver, EndpointURI ep) |
327 | |
throws MuleException |
328 | |
{ |
329 | 0 | String endpointKey = getCounterEndpointKey(receiver.getEndpointURI()); |
330 | |
|
331 | 0 | for (Iterator iterator = ((ServiceCompositeMessageSource) axisComponent.getMessageSource()).getEndpoints().iterator(); iterator.hasNext();) |
332 | |
{ |
333 | 0 | ImmutableEndpoint endpoint = (ImmutableEndpoint) iterator.next(); |
334 | 0 | if (endpointKey.startsWith(endpoint.getEndpointURI().getAddress())) |
335 | |
{ |
336 | 0 | logger.info("Unregistering Axis endpoint: " + endpointKey + " for service: " |
337 | |
+ ((AxisMessageReceiver) receiver).getSoapService().getName()); |
338 | |
} |
339 | |
try |
340 | |
{ |
341 | 0 | endpoint.getConnector() |
342 | |
.unregisterListener(receiver.getEndpoint(), axisComponent); |
343 | |
} |
344 | 0 | catch (Exception e) |
345 | |
{ |
346 | 0 | logger.error("Failed to unregister Axis endpoint: " + endpointKey + " for service: " |
347 | |
+ receiver.getFlowConstruct().getName() + ". Error is: " |
348 | |
+ e.getMessage(), e); |
349 | 0 | } |
350 | 0 | } |
351 | 0 | } |
352 | |
|
353 | |
protected void registerReceiverWithMuleService(MessageReceiver receiver, EndpointURI ep) |
354 | |
throws MuleException |
355 | |
{ |
356 | |
|
357 | |
|
358 | |
|
359 | |
|
360 | |
|
361 | 0 | if (axisComponent == null) |
362 | |
{ |
363 | 0 | axisComponent = getOrCreateAxisComponent(); |
364 | |
} |
365 | |
else |
366 | |
{ |
367 | |
|
368 | |
|
369 | 0 | muleContext.getRegistry().unregisterService(AXIS_SERVICE_PROPERTY + getName()); |
370 | |
} |
371 | |
|
372 | 0 | String serviceName = ((AxisMessageReceiver) receiver).getSoapService().getName(); |
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
String endpoint; |
378 | 0 | String scheme = ep.getScheme().toLowerCase(); |
379 | 0 | if (scheme.equals("jms") || scheme.equals("vm") || scheme.equals("servlet")) |
380 | |
{ |
381 | 0 | endpoint = ep.toString(); |
382 | |
} |
383 | |
else |
384 | |
{ |
385 | 0 | endpoint = receiver.getEndpointURI().getAddress() + "/" + serviceName; |
386 | |
} |
387 | 0 | if (logger.isDebugEnabled()) |
388 | |
{ |
389 | 0 | logger.debug("Modified endpoint with " + scheme + " scheme to " + endpoint); |
390 | |
} |
391 | |
|
392 | 0 | EndpointBuilder serviceEndpointbuilder = new EndpointURIEndpointBuilder(endpoint, muleContext); |
393 | 0 | serviceEndpointbuilder.setExchangePattern(receiver.getEndpoint().getExchangePattern()); |
394 | 0 | serviceEndpointbuilder.setName(ep.getScheme() + ":" + serviceName); |
395 | |
|
396 | 0 | serviceEndpointbuilder.setTransformers(receiver.getEndpoint().getTransformers().isEmpty() ? null |
397 | |
: receiver.getEndpoint().getTransformers()); |
398 | 0 | serviceEndpointbuilder.setResponseTransformers(receiver.getEndpoint().getResponseTransformers().isEmpty() ? null |
399 | |
: receiver.getEndpoint().getResponseTransformers()); |
400 | |
|
401 | 0 | serviceEndpointbuilder.addMessageProcessor(new MessageFilter(receiver.getEndpoint().getFilter())); |
402 | |
|
403 | |
|
404 | 0 | EndpointSecurityFilter securityFilter = receiver.getEndpoint().getSecurityFilter(); |
405 | 0 | if (securityFilter != null) |
406 | |
{ |
407 | 0 | serviceEndpointbuilder.addMessageProcessor(new SecurityFilterMessageProcessor(securityFilter)); |
408 | |
} |
409 | |
|
410 | |
|
411 | |
|
412 | 0 | AbstractEndpointBuilder receiverEndpointBuilder = new EndpointURIEndpointBuilder(receiver.getEndpoint()); |
413 | |
|
414 | |
|
415 | 0 | List<MessageProcessor> procs = new ArrayList(receiverEndpointBuilder.getMessageProcessors()); |
416 | 0 | CollectionUtils.removeType(procs, MessageFilter.class); |
417 | 0 | CollectionUtils.removeType(procs, SecurityFilterMessageProcessor.class); |
418 | 0 | receiverEndpointBuilder.setMessageProcessors(procs); |
419 | |
|
420 | 0 | InboundEndpoint serviceEndpoint = muleContext.getRegistry() |
421 | |
.lookupEndpointFactory() |
422 | |
.getInboundEndpoint(serviceEndpointbuilder); |
423 | |
|
424 | 0 | InboundEndpoint receiverEndpoint = muleContext.getRegistry() |
425 | |
.lookupEndpointFactory() |
426 | |
.getInboundEndpoint(receiverEndpointBuilder); |
427 | |
|
428 | 0 | receiver.setEndpoint(receiverEndpoint); |
429 | |
|
430 | |
|
431 | 0 | ((CompositeMessageSource) axisComponent.getMessageSource()).addSource(serviceEndpoint); |
432 | 0 | } |
433 | |
|
434 | |
private String getCounterEndpointKey(EndpointURI endpointURI) |
435 | |
{ |
436 | 0 | StringBuffer endpointKey = new StringBuffer(64); |
437 | |
|
438 | 0 | endpointKey.append(endpointURI.getScheme()); |
439 | 0 | endpointKey.append("://"); |
440 | 0 | endpointKey.append(endpointURI.getHost()); |
441 | 0 | if (endpointURI.getPort() > -1) |
442 | |
{ |
443 | 0 | endpointKey.append(":"); |
444 | 0 | endpointKey.append(endpointURI.getPort()); |
445 | |
} |
446 | 0 | return endpointKey.toString(); |
447 | |
} |
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
protected Service getOrCreateAxisComponent() throws MuleException |
455 | |
{ |
456 | 0 | Service service = muleContext.getRegistry().lookupService(AXIS_SERVICE_PROPERTY + getName()); |
457 | |
|
458 | 0 | if (service == null) |
459 | |
{ |
460 | |
|
461 | 0 | service = new SedaService(muleContext); |
462 | 0 | service.setName(AXIS_SERVICE_PROPERTY + getName()); |
463 | 0 | service.setModel(muleContext.getRegistry().lookupSystemModel()); |
464 | |
|
465 | 0 | Map props = new HashMap(); |
466 | 0 | props.put(AXIS, axis); |
467 | 0 | SingletonObjectFactory of = new SingletonObjectFactory(AxisServiceComponent.class, props); |
468 | 0 | final DefaultJavaComponent component = new DefaultJavaComponent(of); |
469 | 0 | component.setMuleContext(muleContext); |
470 | 0 | service.setComponent(component); |
471 | |
} |
472 | 0 | return service; |
473 | |
} |
474 | |
|
475 | |
|
476 | |
|
477 | |
|
478 | |
|
479 | |
|
480 | |
@Override |
481 | |
protected void doStart() throws MuleException |
482 | |
{ |
483 | 0 | axis.start(); |
484 | 0 | } |
485 | |
|
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
@Override |
492 | |
protected void doStop() throws MuleException |
493 | |
{ |
494 | 0 | axis.stop(); |
495 | |
|
496 | |
|
497 | 0 | } |
498 | |
|
499 | |
@Override |
500 | |
protected void doConnect() throws Exception |
501 | |
{ |
502 | |
|
503 | 0 | } |
504 | |
|
505 | |
@Override |
506 | |
protected void doDisconnect() throws Exception |
507 | |
{ |
508 | |
|
509 | 0 | } |
510 | |
|
511 | |
@Override |
512 | |
protected void doDispose() |
513 | |
{ |
514 | |
|
515 | 0 | } |
516 | |
|
517 | |
public String getServerConfig() |
518 | |
{ |
519 | 0 | return serverConfig; |
520 | |
} |
521 | |
|
522 | |
public void setServerConfig(String serverConfig) |
523 | |
{ |
524 | 0 | this.serverConfig = serverConfig; |
525 | 0 | } |
526 | |
|
527 | |
public List getBeanTypes() |
528 | |
{ |
529 | 0 | return beanTypes; |
530 | |
} |
531 | |
|
532 | |
public void setBeanTypes(List beanTypes) |
533 | |
{ |
534 | 0 | this.beanTypes = beanTypes; |
535 | 0 | } |
536 | |
|
537 | |
public String getClientConfig() |
538 | |
{ |
539 | 0 | return clientConfig; |
540 | |
} |
541 | |
|
542 | |
public void setClientConfig(String clientConfig) |
543 | |
{ |
544 | 0 | this.clientConfig = clientConfig; |
545 | 0 | } |
546 | |
|
547 | |
public AxisServer getAxis() |
548 | |
{ |
549 | 0 | return axis; |
550 | |
} |
551 | |
|
552 | |
public void setAxis(AxisServer axisServer) |
553 | |
{ |
554 | 0 | this.axis = axisServer; |
555 | 0 | } |
556 | |
|
557 | |
public SimpleProvider getServerProvider() |
558 | |
{ |
559 | 0 | return serverProvider; |
560 | |
} |
561 | |
|
562 | |
public void setServerProvider(SimpleProvider serverProvider) |
563 | |
{ |
564 | 0 | this.serverProvider = serverProvider; |
565 | 0 | } |
566 | |
|
567 | |
public SimpleProvider getClientProvider() |
568 | |
{ |
569 | 0 | return clientProvider; |
570 | |
} |
571 | |
|
572 | |
public void setClientProvider(SimpleProvider clientProvider) |
573 | |
{ |
574 | 0 | this.clientProvider = clientProvider; |
575 | 0 | } |
576 | |
|
577 | |
public Map getAxisTransportProtocols() |
578 | |
{ |
579 | 0 | return axisTransportProtocols; |
580 | |
} |
581 | |
|
582 | |
public void setAxisTransportProtocols(Map axisTransportProtocols) |
583 | |
{ |
584 | 0 | this.axisTransportProtocols.putAll(axisTransportProtocols); |
585 | 0 | } |
586 | |
|
587 | |
void addServletService(SOAPService service) |
588 | |
{ |
589 | 0 | servletServices.add(service); |
590 | 0 | } |
591 | |
|
592 | |
public List getSupportedSchemes() |
593 | |
{ |
594 | 0 | return supportedSchemes; |
595 | |
} |
596 | |
|
597 | |
public void setSupportedSchemes(List supportedSchemes) |
598 | |
{ |
599 | 0 | this.supportedSchemes = supportedSchemes; |
600 | 0 | } |
601 | |
|
602 | |
public boolean isDoAutoTypes() |
603 | |
{ |
604 | 0 | return doAutoTypes; |
605 | |
} |
606 | |
|
607 | |
public void setDoAutoTypes(boolean doAutoTypes) |
608 | |
{ |
609 | 0 | this.doAutoTypes = doAutoTypes; |
610 | 0 | } |
611 | |
|
612 | |
void registerTypes(TypeMappingRegistryImpl registry, List types) throws ClassNotFoundException |
613 | |
{ |
614 | 0 | if (types != null) |
615 | |
{ |
616 | |
Class clazz; |
617 | 0 | for (Iterator iterator = types.iterator(); iterator.hasNext();) |
618 | |
{ |
619 | 0 | clazz = ClassUtils.loadClass(iterator.next().toString(), getClass()); |
620 | 0 | String localName = Types.getLocalNameFromFullName(clazz.getName()); |
621 | 0 | QName xmlType = new QName(Namespaces.makeNamespace(clazz.getName()), localName); |
622 | |
|
623 | 0 | registry.getDefaultTypeMapping().register(clazz, xmlType, |
624 | |
new BeanSerializerFactory(clazz, xmlType), new BeanDeserializerFactory(clazz, xmlType)); |
625 | 0 | } |
626 | |
} |
627 | 0 | } |
628 | |
|
629 | |
public boolean isTreatMapAsNamedParams() |
630 | |
{ |
631 | 0 | return treatMapAsNamedParams; |
632 | |
} |
633 | |
|
634 | |
public void setTreatMapAsNamedParams(boolean treatMapAsNamedParams) |
635 | |
{ |
636 | 0 | this.treatMapAsNamedParams = treatMapAsNamedParams; |
637 | 0 | } |
638 | |
|
639 | |
public void onNotification(MuleContextNotification notification) |
640 | |
{ |
641 | |
try |
642 | |
{ |
643 | 0 | if (notification.getAction() == MuleContextNotification.CONTEXT_STARTED) |
644 | |
{ |
645 | |
|
646 | |
|
647 | |
|
648 | |
|
649 | |
|
650 | |
|
651 | 0 | if (muleContext.getRegistry().lookupService(AXIS_SERVICE_PROPERTY + getName()) == null) |
652 | |
{ |
653 | |
|
654 | |
|
655 | 0 | if (axisComponent == null) |
656 | |
{ |
657 | 0 | axisComponent = getOrCreateAxisComponent(); |
658 | |
} |
659 | 0 | muleContext.getRegistry().registerService(axisComponent); |
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | 0 | for (Iterator iterator = servletServices.iterator(); iterator.hasNext();) |
665 | |
{ |
666 | 0 | SOAPService service = (SOAPService) iterator.next(); |
667 | 0 | ServletConnector servletConnector = (ServletConnector) new TransportFactory(muleContext).getConnectorByProtocol("servlet"); |
668 | 0 | String url = servletConnector.getServletUrl(); |
669 | 0 | if (url != null) |
670 | |
{ |
671 | 0 | service.getServiceDescription().setEndpointURL(url + "/" + service.getName()); |
672 | |
} |
673 | |
else |
674 | |
{ |
675 | 0 | logger.error("The servletUrl property on the ServletConntector has not been set this means that wsdl generation for service '" |
676 | |
+ service.getName() + "' may be incorrect"); |
677 | |
} |
678 | 0 | } |
679 | 0 | servletServices.clear(); |
680 | |
} |
681 | |
} |
682 | |
} |
683 | 0 | catch (MuleException e) |
684 | |
{ |
685 | 0 | handleException(e); |
686 | 0 | } |
687 | 0 | } |
688 | |
} |