1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.transport.cxf.component; |
12 | |
|
13 | |
import org.mule.DefaultMuleMessage; |
14 | |
import org.mule.api.MuleContext; |
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.transport.soap.component.AbstractWebServiceWrapperComponent; |
22 | |
|
23 | 8 | public class WebServiceWrapperComponent extends AbstractWebServiceWrapperComponent |
24 | |
{ |
25 | |
private String wsdlPort; |
26 | |
private String operation; |
27 | |
|
28 | |
protected MuleMessage doOnCall(MuleEvent event) throws Exception |
29 | |
{ |
30 | 4 | MuleContext muleContext = event.getMuleContext(); |
31 | |
|
32 | |
String tempUrl; |
33 | 4 | if (addressFromMessage) |
34 | |
{ |
35 | 2 | tempUrl = event.getMessage().getStringProperty(WS_SERVICE_URL, null); |
36 | 2 | if (tempUrl == null) |
37 | |
{ |
38 | 0 | throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(WS_SERVICE_URL) |
39 | |
.toString()); |
40 | |
} |
41 | |
} |
42 | |
else |
43 | |
{ |
44 | 2 | tempUrl = address; |
45 | |
} |
46 | 4 | MuleMessage message = new DefaultMuleMessage(event.transformMessage()); |
47 | |
|
48 | 4 | EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("cxf:" + tempUrl, muleContext); |
49 | 4 | if (wsdlPort != null) |
50 | |
{ |
51 | 0 | endpointBuilder.setProperty("wsdlPort", wsdlPort); |
52 | |
} |
53 | 4 | if (operation != null) |
54 | |
{ |
55 | 0 | endpointBuilder.setProperty("operation", operation); |
56 | |
|
57 | |
} |
58 | |
|
59 | 4 | OutboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( |
60 | |
endpointBuilder); |
61 | |
|
62 | 4 | MuleMessage result = event.getSession().sendEvent(message, endpoint); |
63 | 4 | return result; |
64 | |
} |
65 | |
|
66 | |
public String getWsdlPort() |
67 | |
{ |
68 | 0 | return wsdlPort; |
69 | |
} |
70 | |
|
71 | |
public void setWsdlPort(String wsdlPort) |
72 | |
{ |
73 | 0 | this.wsdlPort = wsdlPort; |
74 | 0 | } |
75 | |
|
76 | |
public String getOperation() |
77 | |
{ |
78 | 0 | return operation; |
79 | |
} |
80 | |
|
81 | |
public void setOperation(String operation) |
82 | |
{ |
83 | 0 | this.operation = operation; |
84 | 0 | } |
85 | |
|
86 | |
} |