-
1. Re: System property not written from Service Bean
dward Jun 4, 2014 9:57 AM (in response to ovidiu.firicel)Sounds like some sort of lifecycle/ordering issue. Can you share your code of where you're writing it and where you're reading it?
-
2. Re: Re: System property not written from Service Bean
ovidiu.firicel Jun 5, 2014 3:17 AM (in response to dward)Hello David,
I'm attaching a sample ServiceBean which function similar to my application (I will try the next day to come back with a full functional application)...
In the method setEndpoint() I'm deciding based on a System property which system to invoke and I set another System property with the final endpoint
System.setProperty("SO_ROUTE_ENDPOINT", endpoint);
And this System property is used in Switchyard SOAP Reference (invoked from the ServiceBean with sampleRemote.process(request); ). The reference is using this property as an endpoint for the WebService which is invoked:${SO_ROUTE_ENDPOINT}
And at this point the property is not read correctly when the server is just started (while a redeploy of the application will make it work).
Also I have observed something else, the System property is actually set correctly by the method setEndpoint() (I used a logging to check its value after setting), but apparently the SOAP Reference is reading the initial value . And even if I set manually the System property using JBoss CLI, the value is not read correctly.After the application is redeployed, the endpoint is set/read correctly by Switchyard and is set correctly even if I change the system to which will send the request.
As a workaround, I can create two distinct SOAP References (one for each endpoint) and in the Service Bean to call one or the other, but I would have prefered to use only one and change the endpoint only when needed.
Thanks!
-
SampleBean.java 1.6 KB
-
-
3. Re: Re: System property not written from Service Bean
kcbabo Jun 5, 2014 7:52 AM (in response to ovidiu.firicel)Property tokens in switchyard.xml are replaced once at application deployment-time; they are not dynamic. The best way to support this would likely be a context property which allows you to set the SOAP endpoint address on a per-invocation basis. Using a System property can be dangerous if you have concurrent invocations (multiple threads overwriting the property value during invocation).
-
4. Re: Re: System property not written from Service Bean
kcbabo Jun 5, 2014 7:54 AM (in response to kcbabo)I should mention that we don't currently support dynamic assignment of the SOAP address via context property, but there is a JIRA you can vote for here:
[SWITCHYARD-1997] Dynamic "per message" endpoint - JBoss Issue Tracker