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?
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
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:
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.
SampleBean.java 1.6 KB
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).
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: