Page 1 of 1

searchLocations http statuscode 301

Posted: Wed Mar 13, 2019 12:33 pm
by ASOL
Hi there,

after 3 moths i tried the application again and i got a 301 statuscode for searchLocation method in my javaclient.
I´m using the same server as always: "https://xserver2-europe-eu-test.cloud.p ... m/services" and the code also didnt change.
The picture shows the code piece with the searchLocations method.

I dont know what happened in the past months, anything changed?

XMap still works

Re: searchLocations http statuscode 301

Posted: Wed Mar 13, 2019 4:56 pm
by Bernd Welter
Checked this with some admins.

From their perspective it is "ok" and has never been different:
If you try to access the service URL via GET (which is the case in a browser call) you get the mentioned behaviour.
A POST will be handeled properly and that's what the interface was designed for.

Anyway: we discuss whether we update the behaviour in the future (XSERS-1342).

Best regards,
Bernd

Re: searchLocations http statuscode 301

Posted: Thu Mar 14, 2019 2:58 pm
by ASOL
The code worked 3 months ago and now without any changes in my code i get this.
My code is also similar to the examples fromJava example
The complete url is : "https://xserver2-europe-eu-test.cloud.p ... ws/XLocate"

How can i change this into a post request?

Re: searchLocations http statuscode 301

Posted: Fri Mar 15, 2019 9:25 am
by Bernd Welter
Here's another statement from DEV. Not the solution but I'll stay attached to this topic:
The problem is caused by the "http" protocol that is currently specified in the WSDL; java clients download the WSDL and continue requests with the URL stored in the WSDL; this way, the requests is send via HTTP resulting in the 301.

Re: searchLocations http statuscode 301

Posted: Fri Mar 15, 2019 2:15 pm
by Bernd Welter
Hello,

I just spoke to one of our admins who confirmed that a little bug managed to get into test (and only into test).
We will fix this (no due date known). If it is urgent you may get in touch with me 1:1 to get an individual solution.

Best regards,
Bernd

Re: searchLocations http statuscode 301

Posted: Mon Mar 18, 2019 9:51 am
by Bernd Welter
Hello together,

here's a workaround for the issue - works like a charm:

try to explicity set the endpoint address. The following sample worked for me, last line is the fix:

Code: Select all

String url = "https://xserver2-europe-eu-test.cloud.ptvgroup.com/services/ws/XLocate"; 
XLocate client = (XLocate) new XLocate_Service(new URL(url)).getXlocate();   
BindingProvider prov = (BindingProvider)client;  
prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "xtok"); prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "replace-this-with-your-token");
prov.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
Thanks to Frank for the hint,
Bernd