searchLocations http statuscode 301

deals with geocoding and reverse geocoding
Post Reply
ASOL
Posts: 5
Joined: Thu Oct 25, 2018 9:32 am

searchLocations http statuscode 301

Post 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
Attachments
301Error.PNG
Last edited by Bernd Welter on Wed Mar 13, 2019 1:26 pm, edited 1 time in total.
Reason: Forwarded to our experts (Marco, Frank, Mathias)
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: searchLocations http statuscode 301

Post 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
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
ASOL
Posts: 5
Joined: Thu Oct 25, 2018 9:32 am

Re: searchLocations http statuscode 301

Post 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?
Last edited by Bernd Welter on Thu Mar 14, 2019 3:28 pm, edited 1 time in total.
Reason: Forwarded to Marco
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: searchLocations http statuscode 301

Post 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.
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: searchLocations http statuscode 301

Post 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
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: searchLocations http statuscode 301

Post 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
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply