xServer / Token

Proper forum for all questions related to xServer INTERNET = the Azure based cloud solution. This forum deals with the architecture topics such as load balancing, available profiles and standard server settings.
Please be aware that questions about core functionality such as routing, mapping, geocoding in general should be placed in the xServers dedicated forum ;-)
Post Reply
User avatar
Max Beermann
Posts: 68
Joined: Tue Oct 30, 2018 7:36 am

xServer / Token

Post by Max Beermann »

Hey there,

last question for this year;)


How to include the token (e.g. XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) into the URL, so I do not always have to enter it manually?

URL:
https://xserver2.cloud.ptvgroup.com/ser ... s/XLocate/

Many thanks in advance & Happy new year to all of you!
Max
Max Beermann
Development Manager
WHEELS Logistics
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: xServer / Token

Post by Bernd Welter »

Hi Max,
welcome in 2023!

Please add &xtok=yourToken to the URL of the REST call.
Is that what you've been looking for?

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
Max Beermann
Posts: 68
Joined: Tue Oct 30, 2018 7:36 am

Re: xServer / Token

Post by Max Beermann »

Hi Bernd,

Welcome,too :)
Thanks for your reply > I gave it a try.

For the local xServer, the following code works for me:

Code: Select all

Req.Open "Post", "http://msomap4:50000/services/ws/XLocate", False
For xServer internet, the following code raises an error for me (No Service found):

Code: Select all

Req.Open "Post", "https://xserver2.cloud.ptvgroup.com/services/ws/XLocate/&xtok=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", False
Do you see my fault?

PS: The Token-Test is successful.


Best regards
Max
Max Beermann
Development Manager
WHEELS Logistics
User avatar
felix.glueck
Posts: 4
Joined: Fri Apr 22, 2022 7:34 am

Re: xServer / Token

Post by felix.glueck »

Hi Max,

authentication via the url only works with REST(Representational state transfer) endpoints.

For example:

https://xserver2-test.cloud.ptvgroup.co ... XXXXXXXXXX

should work if you paste in your token.

For JSON and SOAP Endpoints you will have to provide your token via Basic access authentication in the http header.

An example of this can be found on the attached screenshot from Postman.

Greetings,

Felix
Attachments
Screenshot 2023-01-03 150019.png
User avatar
Max Beermann
Posts: 68
Joined: Tue Oct 30, 2018 7:36 am

Re: xServer / Token

Post by Max Beermann »

Hi Felix,

thanks for your reply.
Sorry, I need your help here.

I took one example of the raw request runner, see Screenshot.
How to add the header including Username (xtok) and Token (123x-456y-789z)?

Code: Select all

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://xlocate.xserver.ptvgroup.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <xs:searchLocations>
      <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://xlocate.xserver.ptvgroup.com" xsi:type="ns3:SearchByAddressRequest" scope="globalscope" storedProfile="default" coordinateFormat="EPSG:4326">
        <searchOptions outputCountryType="ISO_3166_1_ALPHA_3"/>
        <address city="Garnich"/>
      </request>
    </xs:searchLocations>
  </soap:Body>
</soap:Envelope>

Best regards
Max
Attachments
Capture1.JPG
Max Beermann
Development Manager
WHEELS Logistics
User avatar
Max Beermann
Posts: 68
Joined: Tue Oct 30, 2018 7:36 am

Re: xServer / Token

Post by Max Beermann »

Hi there :)

Is the question clear? Or do you need more information?
I tried so many things > but have no clue/ideas anymore how to make it work.

Glad if we can work it out. 8-)

Best regards
Max
Max Beermann
Development Manager
WHEELS Logistics
User avatar
felix.glueck
Posts: 4
Joined: Fri Apr 22, 2022 7:34 am

Re: xServer / Token

Post by felix.glueck »

Hey Max,

sorry for the late reply.

You can access the header of the raw request runner by pressing the little letter icon at the top of the raw request runner. There you can provide information for the header of your request. But I do not know if this is useful for your intent. Because this information is not saved when downloading the request from the raw request runner.

If you just want to speed up entering your credentials when using the raw request runner, you can try saving them in your browser.

The individual steps differ depending on the web browser. For chrome you have to go to options ->password manager --> Add password --> "Website": https://xserver2-dashboard.cloud.ptvgroup.com ; username: "xtok"; password: "123x-456y-789z".

After that, the credentials should be saved and filled in by your browser everytime you use the raw request runner. Hope this helps!
User avatar
Max Beermann
Posts: 68
Joined: Tue Oct 30, 2018 7:36 am

Re: xServer / Token

Post by Max Beermann »

Good morning Felix,

thanks for your reply.

I took the location-code from the RawRequestRunner for purpose of an example.
Please consider the question independently of the use of RawRequestRunner. Sorry for confusion :? :)

As far as I understood you correctly, the following code needs a header - that is needed for authorization- including Username (xtok) and Token (123x-456y-789z).
My question:
How to add the missing authorization-information within the code?

Code: Select all

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://xlocate.xserver.ptvgroup.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <xs:searchLocations>
      <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://xlocate.xserver.ptvgroup.com" xsi:type="ns3:SearchByAddressRequest" scope="globalscope" storedProfile="default" coordinateFormat="EPSG:4326">
        <searchOptions outputCountryType="ISO_3166_1_ALPHA_3"/>
        <address city="Garnich"/>
      </request>
    </xs:searchLocations>
  </soap:Body>
</soap:Envelope>
Best regards
Max
Max Beermann
Development Manager
WHEELS Logistics
User avatar
felix.glueck
Posts: 4
Joined: Fri Apr 22, 2022 7:34 am

Re: xServer / Token

Post by felix.glueck »

Hi Max,

thanks for the clarification :)

In your screenshot I can only see the body of the message to be transmitted. The header is part of the HTTP protocol and is usually set independently from the body of the message. What programming language, client, library or program are you using to send the message?
User avatar
Max Beermann
Posts: 68
Joined: Tue Oct 30, 2018 7:36 am

Re: xServer / Token

Post by Max Beermann »

Hello Felix,

thank you for your answer!

I use Excel-Vba.
With your help the solution was found!

I could fill in the username and password within the Req:

Dim Req As Object
Set Req = CreateObject("MSXML2.XMLHTTP")
Req.Open "Post", "https://xserver2.cloud.ptvgroup.com/services/ws/XLocate", False, "xtok", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

Maaaany thanks for your help :)

Best regards
Max
Max Beermann
Development Manager
WHEELS Logistics
Post Reply