1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.soap.axis; |
8 | |
|
9 | |
import org.mule.DefaultMuleMessage; |
10 | |
import org.mule.api.MuleContext; |
11 | |
import org.mule.api.MuleEvent; |
12 | |
import org.mule.api.MuleMessage; |
13 | |
import org.mule.api.config.MuleProperties; |
14 | |
import org.mule.api.endpoint.EndpointURI; |
15 | |
import org.mule.api.endpoint.ImmutableEndpoint; |
16 | |
import org.mule.api.endpoint.OutboundEndpoint; |
17 | |
import org.mule.api.transformer.TransformerException; |
18 | |
import org.mule.api.transport.DispatchException; |
19 | |
import org.mule.config.i18n.CoreMessages; |
20 | |
import org.mule.module.cxf.SoapConstants; |
21 | |
import org.mule.transport.AbstractMessageDispatcher; |
22 | |
import org.mule.transport.NullPayload; |
23 | |
import org.mule.transport.soap.axis.i18n.AxisMessages; |
24 | |
import org.mule.util.BeanUtils; |
25 | |
import org.mule.util.StringUtils; |
26 | |
import org.mule.util.TemplateParser; |
27 | |
|
28 | |
import java.util.ArrayList; |
29 | |
import java.util.Arrays; |
30 | |
import java.util.HashMap; |
31 | |
import java.util.Iterator; |
32 | |
import java.util.List; |
33 | |
import java.util.Map; |
34 | |
|
35 | |
import javax.activation.DataHandler; |
36 | |
import javax.xml.namespace.QName; |
37 | |
|
38 | |
import org.apache.axis.AxisProperties; |
39 | |
import org.apache.axis.EngineConfiguration; |
40 | |
import org.apache.axis.MessageContext; |
41 | |
import org.apache.axis.attachments.AttachmentPart; |
42 | |
import org.apache.axis.client.Call; |
43 | |
import org.apache.axis.client.Service; |
44 | |
import org.apache.axis.configuration.FileProvider; |
45 | |
import org.apache.axis.constants.Style; |
46 | |
import org.apache.axis.constants.Use; |
47 | |
import org.apache.axis.wsdl.fromJava.Namespaces; |
48 | |
import org.apache.axis.wsdl.fromJava.Types; |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
public class AxisMessageDispatcher extends AbstractMessageDispatcher |
55 | |
{ |
56 | |
|
57 | |
protected EngineConfiguration clientConfig; |
58 | |
protected AxisConnector connector; |
59 | |
protected Service service; |
60 | |
private Map callParameters; |
61 | |
|
62 | |
public AxisMessageDispatcher(OutboundEndpoint endpoint) |
63 | |
{ |
64 | 0 | super(endpoint); |
65 | 0 | this.connector = (AxisConnector)endpoint.getConnector(); |
66 | 0 | AxisProperties.setProperty("axis.doAutoTypes", Boolean.toString(connector.isDoAutoTypes())); |
67 | 0 | } |
68 | |
|
69 | |
@Override |
70 | |
protected void doConnect() throws Exception |
71 | |
{ |
72 | 0 | if (service == null) |
73 | |
{ |
74 | 0 | service = createService(endpoint); |
75 | |
} |
76 | 0 | } |
77 | |
|
78 | |
@Override |
79 | |
protected void doDisconnect() throws Exception |
80 | |
{ |
81 | 0 | if (service != null) |
82 | |
{ |
83 | 0 | service = null; |
84 | |
} |
85 | 0 | } |
86 | |
|
87 | |
@Override |
88 | |
protected void doDispose() |
89 | |
{ |
90 | |
|
91 | 0 | } |
92 | |
|
93 | |
protected synchronized EngineConfiguration getClientConfig(ImmutableEndpoint endpoint) |
94 | |
{ |
95 | 0 | if (clientConfig == null) |
96 | |
{ |
97 | |
|
98 | |
String config; |
99 | 0 | config = (String)endpoint.getProperty(AxisConnector.AXIS_CLIENT_CONFIG_PROPERTY); |
100 | |
|
101 | 0 | if (config != null) |
102 | |
{ |
103 | 0 | clientConfig = new FileProvider(config); |
104 | |
} |
105 | |
else |
106 | |
{ |
107 | 0 | clientConfig = connector.getClientProvider(); |
108 | |
} |
109 | |
} |
110 | 0 | return clientConfig; |
111 | |
} |
112 | |
|
113 | |
protected Service createService(ImmutableEndpoint endpoint) throws Exception |
114 | |
{ |
115 | |
|
116 | 0 | EngineConfiguration config = getClientConfig(endpoint); |
117 | 0 | return new Service(config); |
118 | |
} |
119 | |
|
120 | |
@Override |
121 | |
protected void doDispatch(MuleEvent event) throws Exception |
122 | |
{ |
123 | 0 | Object[] args = getArgs(event); |
124 | 0 | Call call = getCall(event, args); |
125 | |
|
126 | |
|
127 | |
|
128 | |
|
129 | 0 | call.setProperty("axis.one.way", Boolean.TRUE); |
130 | 0 | call.setProperty(MuleProperties.MULE_EVENT_PROPERTY, event); |
131 | 0 | call.setProperty(MuleProperties.MULE_CONTEXT_PROPERTY, connector.getMuleContext()); |
132 | 0 | call.invoke(args); |
133 | 0 | } |
134 | |
|
135 | |
@Override |
136 | |
protected MuleMessage doSend(MuleEvent event) throws Exception |
137 | |
{ |
138 | |
Call call; |
139 | |
Object result; |
140 | 0 | Object[] args = getArgs(event); |
141 | 0 | call = getCall(event, args); |
142 | 0 | result = call.invoke(args); |
143 | 0 | if (result == null) |
144 | |
{ |
145 | 0 | return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext()); |
146 | |
} |
147 | |
else |
148 | |
{ |
149 | 0 | MuleMessage resultMessage = new DefaultMuleMessage(result, event.getMessage(), event.getMuleContext()); |
150 | 0 | setMessageContextProperties(resultMessage, call.getMessageContext()); |
151 | 0 | return resultMessage; |
152 | |
} |
153 | |
} |
154 | |
|
155 | |
protected Call getCall(MuleEvent event, Object[] args) throws Exception |
156 | |
{ |
157 | 0 | EndpointURI endpointUri = event.getEndpoint().getEndpointURI(); |
158 | 0 | Object method = getInitialMethod(event); |
159 | 0 | Call call = (Call) service.createCall(); |
160 | 0 | parseStyle(event, call); |
161 | 0 | parseUse(event, call); |
162 | |
|
163 | |
|
164 | 0 | BeanUtils.populateWithoutFail(call, event.getEndpoint().getProperties(), false); |
165 | 0 | call.setTargetEndpointAddress(endpointUri.getAddress()); |
166 | |
|
167 | 0 | method = refineMethod(event, call, method); |
168 | 0 | String methodNamespace = call.getOperationName().getNamespaceURI(); |
169 | |
|
170 | |
|
171 | 0 | call.setProperty(MuleProperties.MULE_EVENT_PROPERTY, event); |
172 | 0 | call.setProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, event.getEndpoint()); |
173 | 0 | call.setProperty(MuleProperties.MULE_CONTEXT_PROPERTY, connector.getMuleContext()); |
174 | |
|
175 | 0 | setCustomProperties(event, call); |
176 | 0 | call.setTimeout(new Integer(event.getTimeout())); |
177 | 0 | setUserCredentials(endpointUri, call); |
178 | |
|
179 | 0 | Map methodCalls = event.getMessage().getOutboundProperty(AxisConnector.SOAP_METHODS); |
180 | 0 | if (methodCalls == null && !(method instanceof SoapMethod)) |
181 | |
{ |
182 | 0 | buildSoapMethods(event, call, method, methodNamespace, args); |
183 | |
} |
184 | |
|
185 | 0 | setCallParams(call, event, call.getOperationName()); |
186 | 0 | setSoapAction(event, endpointUri, call); |
187 | 0 | addAttachments(event, call); |
188 | 0 | return call; |
189 | |
} |
190 | |
|
191 | |
protected void addAttachments(MuleEvent event, Call call) |
192 | |
{ |
193 | |
|
194 | 0 | for (Iterator iterator = event.getMessage().getOutboundAttachmentNames().iterator(); iterator.hasNext();) |
195 | |
{ |
196 | 0 | String name = (String)iterator.next(); |
197 | 0 | DataHandler dh = event.getMessage().getOutboundAttachment(name); |
198 | 0 | AttachmentPart part = new AttachmentPart(dh); |
199 | 0 | call.addAttachmentPart(part); |
200 | 0 | } |
201 | 0 | } |
202 | |
|
203 | |
protected void setSoapAction(MuleEvent event, EndpointURI endpointUri, Call call) |
204 | |
{ |
205 | |
|
206 | 0 | String soapAction = event.getMessage().getOutboundProperty(SoapConstants.SOAP_ACTION_PROPERTY); |
207 | 0 | if (soapAction != null) |
208 | |
{ |
209 | 0 | soapAction = parseSoapAction(soapAction, call.getOperationName(), event); |
210 | 0 | call.setSOAPActionURI(soapAction); |
211 | 0 | call.setUseSOAPAction(true); |
212 | |
} |
213 | |
else |
214 | |
{ |
215 | 0 | call.setSOAPActionURI(endpointUri.getAddress()); |
216 | |
} |
217 | 0 | } |
218 | |
|
219 | |
protected void buildSoapMethods(MuleEvent event, Call call, Object method, String methodNamespace, Object[] args) |
220 | |
{ |
221 | 0 | List params = new ArrayList(); |
222 | 0 | for (int i = 0; i < args.length; i++) |
223 | |
{ |
224 | 0 | if (args[i] == null) |
225 | |
{ |
226 | 0 | QName qname = call.getTypeMapping().getTypeQName(Object.class); |
227 | 0 | params.add(String.format("value%d;qname{%s:%s:%s};in", |
228 | |
i, qname.getPrefix(), qname.getLocalPart(), qname.getNamespaceURI())); |
229 | 0 | } |
230 | 0 | else if (args[i] instanceof DataHandler[]) |
231 | |
{ |
232 | 0 | params.add("attachments;qname{DataHandler:http://xml.apache.org/xml-soap};in"); |
233 | |
|
234 | |
} |
235 | 0 | else if (args[i] instanceof Map && connector.isTreatMapAsNamedParams()) |
236 | |
{ |
237 | 0 | for (Iterator iterator = ((Map)args[i]).entrySet().iterator(); iterator.hasNext();) |
238 | |
{ |
239 | 0 | Map.Entry entry = (Map.Entry)iterator.next(); |
240 | 0 | if (call.getTypeMapping().getTypeQName(entry.getValue().getClass()) != null) |
241 | |
{ |
242 | 0 | QName type = call.getTypeMapping().getTypeQName(entry.getValue().getClass()); |
243 | 0 | params.add(String.format("qname{%s%s};qname{%s:%s:%s};in", |
244 | |
entry.getKey().toString(), |
245 | |
(methodNamespace == null ? "" : ":" + methodNamespace), |
246 | |
type.getPrefix(), type.getLocalPart(), type.getNamespaceURI())); |
247 | 0 | } |
248 | |
else |
249 | |
{ |
250 | 0 | params.add(String.format("value%d;qname{%s:%s};in", |
251 | |
i, Types.getLocalNameFromFullName(args[i].getClass().getName()), |
252 | |
Namespaces.makeNamespace(args[i].getClass().getName()))); |
253 | 0 | params.add(String.format("qname{%s%s};qname{%s:%s};in", |
254 | |
entry.getKey().toString(), |
255 | |
(methodNamespace == null ? "" : ":" + methodNamespace), |
256 | |
Types.getLocalNameFromFullName(args[i].getClass().getName()), |
257 | |
Namespaces.makeNamespace(args[i].getClass().getName()))); |
258 | |
} |
259 | |
|
260 | 0 | } |
261 | |
} |
262 | 0 | else if (call.getTypeMapping().getTypeQName(args[i].getClass()) != null) |
263 | |
{ |
264 | 0 | QName qname = call.getTypeMapping().getTypeQName(args[i].getClass()); |
265 | 0 | params.add(String.format("value%d;qname{%s:%s:%s};in", |
266 | |
i, qname.getPrefix(), qname.getLocalPart(), qname.getNamespaceURI())); |
267 | 0 | } |
268 | |
else |
269 | |
{ |
270 | 0 | params.add(String.format("value%d;qname{%s:%s};in", |
271 | |
i, Types.getLocalNameFromFullName(args[i].getClass().getName()), |
272 | |
Namespaces.makeNamespace(args[i].getClass().getName()))); |
273 | |
} |
274 | |
} |
275 | |
|
276 | 0 | HashMap map = new HashMap(); |
277 | 0 | map.put(method, params); |
278 | 0 | event.getMessage().setOutboundProperty(AxisConnector.SOAP_METHODS, map); |
279 | 0 | } |
280 | |
|
281 | |
protected void setUserCredentials(EndpointURI endpointUri, Call call) |
282 | |
{ |
283 | 0 | if (endpointUri.getUserInfo() != null) |
284 | |
{ |
285 | 0 | call.setUsername(endpointUri.getUser()); |
286 | 0 | call.setPassword(endpointUri.getPassword()); |
287 | |
} |
288 | 0 | } |
289 | |
|
290 | |
protected void setCustomProperties(MuleEvent event, Call call) |
291 | |
{ |
292 | 0 | for (String key : event.getMessage().getOutboundPropertyNames()) |
293 | |
{ |
294 | 0 | if (!(key.startsWith(MuleProperties.PROPERTY_PREFIX))) |
295 | |
{ |
296 | 0 | Object value = event.getMessage().getOutboundProperty(key); |
297 | 0 | if (value != null) |
298 | |
{ |
299 | 0 | call.setProperty(key, value); |
300 | |
} |
301 | 0 | } |
302 | |
} |
303 | 0 | } |
304 | |
|
305 | |
protected Object refineMethod(MuleEvent event, Call call, Object method) |
306 | |
{ |
307 | 0 | if (method instanceof String) |
308 | |
{ |
309 | |
|
310 | |
|
311 | 0 | String methodNamespace = event.getMessage().getOutboundProperty(SoapConstants.METHOD_NAMESPACE_PROPERTY); |
312 | 0 | if (methodNamespace != null) |
313 | |
{ |
314 | 0 | call.setOperationName(new QName(methodNamespace, method.toString())); |
315 | |
} |
316 | |
else |
317 | |
{ |
318 | 0 | call.setOperationName(new QName(method.toString())); |
319 | |
} |
320 | 0 | } |
321 | 0 | else if (method instanceof QName) |
322 | |
{ |
323 | 0 | call.setOperationName((QName)method); |
324 | 0 | method = ((QName)method).getLocalPart(); |
325 | |
} |
326 | |
else |
327 | |
{ |
328 | 0 | call.setOperationName(((SoapMethod)method).getName()); |
329 | |
} |
330 | 0 | return method; |
331 | |
} |
332 | |
|
333 | |
protected void parseUse(MuleEvent event, Call call) |
334 | |
{ |
335 | |
|
336 | 0 | String use = event.getMessage().getOutboundProperty(AxisConnector.USE); |
337 | 0 | if (use != null) |
338 | |
{ |
339 | 0 | Use u = Use.getUse(use); |
340 | 0 | if (u == null) |
341 | |
{ |
342 | 0 | throw new IllegalArgumentException( |
343 | |
CoreMessages.valueIsInvalidFor(use, AxisConnector.USE).toString()); |
344 | |
} |
345 | |
else |
346 | |
{ |
347 | 0 | call.setOperationUse(u); |
348 | |
} |
349 | |
} |
350 | 0 | } |
351 | |
|
352 | |
protected void parseStyle(MuleEvent event, Call call) |
353 | |
{ |
354 | |
|
355 | |
|
356 | |
|
357 | 0 | String style = event.getMessage().getOutboundProperty(AxisConnector.STYLE); |
358 | 0 | if (style != null) |
359 | |
{ |
360 | 0 | Style s = Style.getStyle(style); |
361 | 0 | if (s == null) |
362 | |
{ |
363 | 0 | throw new IllegalArgumentException( |
364 | |
CoreMessages.valueIsInvalidFor(style, AxisConnector.STYLE).toString()); |
365 | |
} |
366 | |
else |
367 | |
{ |
368 | 0 | call.setOperationStyle(s); |
369 | |
} |
370 | |
} |
371 | 0 | } |
372 | |
|
373 | |
protected Object getInitialMethod(MuleEvent event) throws DispatchException |
374 | |
{ |
375 | 0 | Object method = event.getMessage().getOutboundProperty(MuleProperties.MULE_METHOD_PROPERTY); |
376 | 0 | if (method == null) |
377 | |
{ |
378 | 0 | method = event.getEndpoint().getEndpointURI().getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY); |
379 | |
} |
380 | 0 | if (method == null) |
381 | |
{ |
382 | 0 | throw new DispatchException(AxisMessages.cannotInvokeCallWithoutOperation(), |
383 | |
event, this); |
384 | |
} |
385 | 0 | else if (method instanceof SoapMethod) |
386 | |
{ |
387 | 0 | synchronized (this) |
388 | |
{ |
389 | 0 | if (callParameters == null) |
390 | |
{ |
391 | 0 | callParameters = new HashMap(); |
392 | |
} |
393 | 0 | callParameters.put(((SoapMethod) method).getName().getLocalPart(), method); |
394 | 0 | } |
395 | |
} |
396 | 0 | return method; |
397 | |
} |
398 | |
|
399 | |
private Object[] getArgs(MuleEvent event) throws TransformerException |
400 | |
{ |
401 | 0 | Object payload = event.getMessage().getPayload(); |
402 | |
Object[] args; |
403 | 0 | if (payload instanceof Object[]) |
404 | |
{ |
405 | 0 | args = (Object[])payload; |
406 | |
} |
407 | |
else |
408 | |
{ |
409 | 0 | args = new Object[]{payload}; |
410 | |
} |
411 | 0 | if (event.getMessage().getOutboundAttachmentNames() != null |
412 | |
&& event.getMessage().getOutboundAttachmentNames().size() > 0) |
413 | |
{ |
414 | 0 | ArrayList attachments = new ArrayList(); |
415 | 0 | Iterator i = event.getMessage().getOutboundAttachmentNames().iterator(); |
416 | 0 | while (i.hasNext()) |
417 | |
{ |
418 | 0 | attachments.add(event.getMessage().getOutboundAttachment((String)i.next())); |
419 | |
} |
420 | 0 | ArrayList temp = new ArrayList(Arrays.asList(args)); |
421 | 0 | temp.add(attachments.toArray(new DataHandler[attachments.size()])); |
422 | 0 | args = temp.toArray(); |
423 | |
} |
424 | 0 | return args; |
425 | |
} |
426 | |
|
427 | |
protected void setMessageContextProperties(MuleMessage message, MessageContext ctx) |
428 | |
{ |
429 | 0 | String temp = ctx.getStrProp(MuleProperties.MULE_CORRELATION_ID_PROPERTY); |
430 | 0 | if (StringUtils.isNotBlank(temp)) |
431 | |
{ |
432 | 0 | message.setCorrelationId(temp); |
433 | |
} |
434 | 0 | temp = ctx.getStrProp(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY); |
435 | 0 | if (StringUtils.isNotBlank(temp)) |
436 | |
{ |
437 | 0 | message.setCorrelationGroupSize(Integer.parseInt(temp)); |
438 | |
} |
439 | 0 | temp = ctx.getStrProp(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY); |
440 | 0 | if (StringUtils.isNotBlank(temp)) |
441 | |
{ |
442 | 0 | message.setCorrelationSequence(Integer.parseInt(temp)); |
443 | |
} |
444 | 0 | temp = ctx.getStrProp(MuleProperties.MULE_REPLY_TO_PROPERTY); |
445 | 0 | if (StringUtils.isNotBlank(temp)) |
446 | |
{ |
447 | 0 | message.setReplyTo(temp); |
448 | |
} |
449 | 0 | } |
450 | |
|
451 | |
protected void setMessageContextAttachments(MuleMessage message, MessageContext ctx) throws Exception |
452 | |
{ |
453 | 0 | int x = 0; |
454 | 0 | for (Iterator iterator = ctx.getMessage().getAttachments(); iterator.hasNext(); x++) |
455 | |
{ |
456 | 0 | message.addOutboundAttachment(String.valueOf(x), |
457 | |
((AttachmentPart)iterator.next()).getActivationDataHandler()); |
458 | |
} |
459 | 0 | } |
460 | |
|
461 | |
protected static MuleMessage createMessage(Object result, Call call, MuleContext muleContext) |
462 | |
{ |
463 | 0 | if (result == null) |
464 | |
{ |
465 | 0 | result = NullPayload.getInstance(); |
466 | |
} |
467 | 0 | Map props = new HashMap(); |
468 | 0 | Iterator iter = call.getMessageContext().getPropertyNames(); |
469 | |
Object key; |
470 | 0 | while (iter.hasNext()) |
471 | |
{ |
472 | 0 | key = iter.next(); |
473 | 0 | props.put(key, call.getMessageContext().getProperty(key.toString())); |
474 | |
} |
475 | 0 | props.put("soap.message", call.getMessageContext().getMessage()); |
476 | 0 | call.clearHeaders(); |
477 | 0 | call.clearOperation(); |
478 | 0 | return new DefaultMuleMessage(result, props, muleContext); |
479 | |
} |
480 | |
|
481 | |
public String parseSoapAction(String soapAction, QName method, MuleEvent event) |
482 | |
{ |
483 | 0 | EndpointURI endpointURI = event.getEndpoint().getEndpointURI(); |
484 | 0 | Map properties = new HashMap(); |
485 | 0 | MuleMessage msg = event.getMessage(); |
486 | 0 | for (String propertyKey : msg.getOutboundPropertyNames()) |
487 | |
{ |
488 | 0 | Object value = msg.getOutboundProperty(propertyKey); |
489 | 0 | properties.put(propertyKey, value); |
490 | 0 | } |
491 | 0 | properties.put(MuleProperties.MULE_METHOD_PROPERTY, method.getLocalPart()); |
492 | 0 | properties.put("methodNamespace", method.getNamespaceURI()); |
493 | 0 | properties.put("address", endpointURI.getAddress()); |
494 | 0 | properties.put("scheme", endpointURI.getScheme()); |
495 | 0 | properties.put("host", endpointURI.getHost()); |
496 | 0 | properties.put("port", String.valueOf(endpointURI.getPort())); |
497 | 0 | properties.put("path", endpointURI.getPath()); |
498 | 0 | properties.put("hostInfo", endpointURI.getScheme() |
499 | |
+ "://" |
500 | |
+ endpointURI.getHost() |
501 | |
+ (endpointURI.getPort() > -1 |
502 | |
? ":" + String.valueOf(endpointURI.getPort()) : "")); |
503 | 0 | if (event.getFlowConstruct() != null) |
504 | |
{ |
505 | 0 | properties.put("serviceName", event.getFlowConstruct().getName()); |
506 | |
} |
507 | |
|
508 | 0 | TemplateParser tp = TemplateParser.createMuleStyleParser(); |
509 | 0 | soapAction = tp.parse(properties, soapAction); |
510 | |
|
511 | 0 | if (logger.isDebugEnabled()) |
512 | |
{ |
513 | 0 | logger.debug("SoapAction for this call is: " + soapAction); |
514 | |
} |
515 | 0 | return soapAction; |
516 | |
} |
517 | |
|
518 | |
private void setCallParams(Call call, MuleEvent event, QName method) throws ClassNotFoundException |
519 | |
{ |
520 | 0 | synchronized (this) |
521 | |
{ |
522 | 0 | if (callParameters == null) |
523 | |
{ |
524 | 0 | loadCallParams(event, method.getNamespaceURI()); |
525 | |
} |
526 | 0 | } |
527 | |
|
528 | 0 | SoapMethod soapMethod = (SoapMethod)event.getMessage().removeProperty(MuleProperties.MULE_SOAP_METHOD); |
529 | 0 | if (soapMethod == null) |
530 | |
{ |
531 | 0 | soapMethod = (SoapMethod)callParameters.get(method.getLocalPart()); |
532 | |
} |
533 | |
|
534 | 0 | if (soapMethod != null) |
535 | |
{ |
536 | 0 | for (Iterator iterator = soapMethod.getNamedParameters().iterator(); iterator.hasNext();) |
537 | |
{ |
538 | 0 | NamedParameter parameter = (NamedParameter)iterator.next(); |
539 | 0 | call.addParameter(parameter.getName(), parameter.getType(), parameter.getMode()); |
540 | 0 | } |
541 | |
|
542 | 0 | if (soapMethod.getReturnType() != null) |
543 | |
{ |
544 | 0 | call.setReturnType(soapMethod.getReturnType()); |
545 | |
} |
546 | 0 | else if (soapMethod.getReturnClass() != null) |
547 | |
{ |
548 | 0 | call.setReturnClass(soapMethod.getReturnClass()); |
549 | |
} |
550 | |
|
551 | 0 | call.setOperationName(soapMethod.getName()); |
552 | |
} |
553 | 0 | } |
554 | |
|
555 | |
private void loadCallParams(MuleEvent event, String namespace) throws ClassNotFoundException |
556 | |
{ |
557 | 0 | Map methodCalls = event.getMessage().getOutboundProperty(AxisConnector.SOAP_METHODS); |
558 | 0 | if (methodCalls == null) |
559 | |
{ |
560 | 0 | return; |
561 | |
} |
562 | |
|
563 | |
Map.Entry entry; |
564 | |
SoapMethod soapMethod; |
565 | 0 | callParameters = new HashMap(); |
566 | |
|
567 | 0 | for (Iterator iterator = methodCalls.entrySet().iterator(); iterator.hasNext();) |
568 | |
{ |
569 | 0 | entry = (Map.Entry)iterator.next(); |
570 | 0 | if (StringUtils.isEmpty(namespace)) |
571 | |
{ |
572 | 0 | if (entry.getValue() instanceof List) |
573 | |
{ |
574 | 0 | soapMethod = new SoapMethod(entry.getKey().toString(), (List)entry.getValue()); |
575 | |
} |
576 | |
else |
577 | |
{ |
578 | 0 | soapMethod = new SoapMethod(entry.getKey().toString(), entry.getValue().toString()); |
579 | |
} |
580 | |
} |
581 | |
else |
582 | |
{ |
583 | 0 | if (entry.getValue() instanceof List) |
584 | |
{ |
585 | 0 | soapMethod = new SoapMethod(new QName(namespace, entry.getKey().toString()), |
586 | |
(List)entry.getValue()); |
587 | |
} |
588 | |
else |
589 | |
{ |
590 | 0 | soapMethod = new SoapMethod(new QName(namespace, entry.getKey().toString()), |
591 | |
entry.getValue().toString()); |
592 | |
} |
593 | |
} |
594 | 0 | callParameters.put(soapMethod.getName().getLocalPart(), soapMethod); |
595 | |
} |
596 | 0 | } |
597 | |
|
598 | |
} |