1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.soap.axis.component; |
8 | |
|
9 | |
import org.mule.DefaultMuleEvent; |
10 | |
import org.mule.MessageExchangePattern; |
11 | |
import org.mule.api.MuleEvent; |
12 | |
import org.mule.api.MuleMessage; |
13 | |
import org.mule.api.endpoint.EndpointBuilder; |
14 | |
import org.mule.api.endpoint.OutboundEndpoint; |
15 | |
import org.mule.config.i18n.CoreMessages; |
16 | |
import org.mule.endpoint.EndpointURIEndpointBuilder; |
17 | |
import org.mule.module.cxf.component.AbstractWebServiceWrapperComponent; |
18 | |
import org.mule.transport.soap.axis.AxisConnector; |
19 | |
|
20 | |
import java.util.Map; |
21 | |
|
22 | 0 | public class WebServiceWrapperComponent extends AbstractWebServiceWrapperComponent |
23 | |
{ |
24 | |
|
25 | |
private String use; |
26 | |
private String style; |
27 | |
private Map properties; |
28 | |
|
29 | |
@Override |
30 | |
protected Object doInvoke(MuleEvent event) throws Exception |
31 | |
{ |
32 | |
String tempUrl; |
33 | 0 | if (addressFromMessage) |
34 | |
{ |
35 | 0 | tempUrl = event.getMessage().getInboundProperty(WS_SERVICE_URL); |
36 | 0 | if (tempUrl == null) |
37 | |
{ |
38 | 0 | throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(WS_SERVICE_URL) |
39 | |
.toString()); |
40 | |
} |
41 | |
} |
42 | |
else |
43 | |
{ |
44 | 0 | tempUrl = address; |
45 | |
} |
46 | 0 | MuleMessage message = event.getMessage(); |
47 | |
|
48 | 0 | if (properties != null && properties.get(AxisConnector.SOAP_METHODS) != null) |
49 | |
{ |
50 | 0 | message.addProperties((Map) properties.get(AxisConnector.SOAP_METHODS)); |
51 | |
} |
52 | |
|
53 | 0 | EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("axis:" + tempUrl, muleContext); |
54 | 0 | if (use != null) |
55 | |
{ |
56 | 0 | endpointBuilder.setProperty(AxisConnector.USE, use); |
57 | |
} |
58 | 0 | if (style != null) |
59 | |
{ |
60 | 0 | endpointBuilder.setProperty(AxisConnector.STYLE, style); |
61 | |
|
62 | |
} |
63 | |
|
64 | 0 | endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE); |
65 | |
|
66 | 0 | OutboundEndpoint endpoint = endpointBuilder.buildOutboundEndpoint(); |
67 | |
|
68 | 0 | MuleEvent responseEvent = endpoint.process(new DefaultMuleEvent(event.getMessage(), endpoint, |
69 | |
event.getSession())); |
70 | |
|
71 | 0 | if (responseEvent != null) |
72 | |
{ |
73 | 0 | return responseEvent.getMessage(); |
74 | |
} |
75 | |
else |
76 | |
{ |
77 | 0 | return null; |
78 | |
} |
79 | |
} |
80 | |
|
81 | |
public String getUse() |
82 | |
{ |
83 | 0 | return use; |
84 | |
} |
85 | |
|
86 | |
public void setUse(String use) |
87 | |
{ |
88 | 0 | this.use = use; |
89 | 0 | } |
90 | |
|
91 | |
public String getStyle() |
92 | |
{ |
93 | 0 | return style; |
94 | |
} |
95 | |
|
96 | |
public void setStyle(String style) |
97 | |
{ |
98 | 0 | this.style = style; |
99 | 0 | } |
100 | |
|
101 | |
public Map getProperties() |
102 | |
{ |
103 | 0 | return properties; |
104 | |
} |
105 | |
|
106 | |
public void setProperties(Map properties) |
107 | |
{ |
108 | 0 | this.properties = properties; |
109 | 0 | } |
110 | |
|
111 | |
} |