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