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