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