-
1. Re: SOAP endpoint address
jorgemoralespou_2 Nov 21, 2014 7:03 PM (in response to ozkin)1 of 1 people found this helpfulYou can't. There is a JIRA for it. Hopefully will make it into 2.0.0, but it doesn't seem as of now.
Please, search for JIRA and vote for it. It's something like set endpoints dinamically.
-
2. Re: SOAP endpoint address
ozkin Nov 23, 2014 11:51 AM (in response to jorgemoralespou_2)That's very unfortunate. So, it seems one solution would be then to implement a native client (say, JaxWS) and use it in my bean instead of reference binding... (in scenario where SY application has to invoke the same WS on few different servers).
-
3. Re: SOAP endpoint address
ozkin Nov 23, 2014 4:56 PM (in response to ozkin)I found a workaround for this problem. It uses WS addressing.
1. In WSDL file add " <wsaw:UsingAddressing required="true"/>".
2. In the Bean set the "To" property on the Exchange:
String toStr = "<wsa:To xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">WS_URL</wsa:To>";
Element to = XMLHelper.getDocumentFromString(toStr).getDocumentElement();
i.getContext().setProperty("{http://www.w3.org/2005/08/addressing}To", to, Scope.EXCHANGE);
where i is an instance of ReferenceInvocation for the web service.
Switchyard's OutboundHandler.handleMessage() method always checks if Addressing is enabled and if so it reads above property and sets JaxWS endpoint address.
With above solution one can change "WS_URL" address dynamically at run-time...
-
4. Re: SOAP endpoint address
ozkin Nov 23, 2014 6:08 PM (in response to ozkin)But to my understanding this approach works only if there is no need to deal with two or more endpoint addresses at the same time.
If there is one SOAP Reference Binding, then there is one JaxWS Dispatch object (per that binding). And that means that only one endpoint address can be active at the same time. Thus if a Bean has to handle multiple requests to different endpoints concurrently, then it can cause a mess with invoking a request on the right endpoint address (unless some locking is implemented on invoke() method, which makes it inefficient).
-
5. Re: SOAP endpoint address
ozkin Nov 25, 2014 3:14 AM (in response to ozkin)hello! Can any of the experts have a look at the above suggestion and tell if it has any problems or whether it is ok?
It is working for me but wanted to check if there are any hidden drawbacks..
Thanks.
-
6. Re: SOAP endpoint address
aymanyaq Nov 26, 2014 3:55 PM (in response to ozkin)I had a similar requirement , i used camel binding with a spring-ws as the implementation. I would set the Header CamelSpringWebserviceEndpointUri to my dynamic URL.
You will need though to install this module when you deploy to JBOSS server.
-
7. Re: SOAP endpoint address
ozkin Nov 26, 2014 4:01 PM (in response to aymanyaq)Thanks. Have you been able to set URL per outgoing message? So that concurrent requests to your service could successfully be dispatched to different endpoints at same time?
-
8. Re: SOAP endpoint address
aymanyaq Nov 26, 2014 4:35 PM (in response to ozkin)1 of 1 people found this helpfulYes i was able to set the URL per outgoing message. I do set it as a header property on the exchange and spring-ws will use that instead of the default URL if provided.
.setHeader("CamelSpringWebserviceEndpointUri",
simple("${body.getResults()[0].get('RESULT')}"))
.setBody(simple("${body.getResults()[0].get('PAYLOAD')}"))
.to("switchyard://CBInternalWebServicePortType")
My Config URI on the switchyard reference
spring-ws:http://foo.com/bar?timeout=${td.retail.credit.app.imaging.timeout}
-
9. Re: SOAP endpoint address
ozkin Nov 26, 2014 5:31 PM (in response to aymanyaq)Thanks. I also read somewhere that another alternative could be using Camel URI binding with the camel-http
component. The idea is similar: to change the header property "Exchange.HTTP_URI" on the exchange.