In doing so we came across an important caveat: The WSDL returned by the TEST endpoint sets the service location to "localhost:50000".
When you use the xServer 2.x Java client exactly as suggested in the official documentation, it will work fine as long as you connect to the endpoint of the LIVE version:
Example for xLocate 2.x:
Code: Select all
XLocate client = new XLocate_Service(new URL("https://xserver2-europe-eu.cloud.ptvgroup.com/services/ws/XLocate")).getXlocate();
The reason is that the SOAP client used by the PTV client implementation won't really connect to the endpoint you put here; instead, it will only use that URL to download the WSDL file. Then, it will use URL that is in the "wsdl:service" element in that document.
For the live version, there is no problem since the URL in the WSDL is identical to the URL of the WSDL.
For the test version, however, the URL in the WSDL points to "http://localhost:50000", sending the call back to your own machine, which of course fails, unless you have an instance of xServer running locally.
For proof, open the LIVE endpoint in a browser and scroll all the way down:
https://xserver2-europe-eu.cloud.ptvgro ... ocate?wsdl
At the very end of the document returned, you will find this service definition:
Code: Select all
<wsdl:service xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="XLocate">
<wsdl:port binding="ns28:XLocateSoapBinding" name="xlocate">
<soap12:address xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" location="https://xserver2-europe-eu.cloud.ptvgroup.com/services/ws/XLocate"/>
</wsdl:port>
</wsdl:service>
Code: Select all
<wsdl:service xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="XLocate">
<wsdl:port binding="ns28:XLocateSoapBinding" name="xlocate">
<soap12:address xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" location="http://localhost:50000/services/ws/XLocate"/>
</wsdl:port>
</wsdl:service>
To work around this issue, you will have to set the ENDPOINT_ADDRESS_PROPERTY to the service after you've instantiated the service client:
Code: Select all
XLocate client = new XLocate_Service(new URL("https://xserver2-europe-eu-test.cloud.ptvgroup.com/services/ws/XLocate")).getXlocate();
((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://xserver2-europe-eu-test.cloud.ptvgroup.com/services/ws/XLocate");
Is the TEST WSDL supposed to look like that? Would it make sense to change the wsdl:service location in the WSDL to point to the actual service cloud endpoint, instead of localhost?
This would make the above workaround obsolete.
Regards
Oliver