Calling Webservice from another webservice

Lefteyed
Lefteyed Member Posts: 43
Hey guys

I have an issue with calling a webserivce within NAV from another webservice.

The setup is like this:

There is a Webshop that users can login to. Users can be either Danish, German, Swedish or others.
There is a dataport set up to access the main company thorough a webservice (codeunit - Function "Process").

This codeunit checks which county the users is from and then calls a webservice (same codeunit - Function "Process2") to the correct company.


The issue is when calling this second webservice I get an 401 error:

x9s01rtlrscw.png

Best Answers

  • Lefteyed
    Lefteyed Member Posts: 43
    Answer ✓
    When calling the first webservice there was no problem with AD user.
    Tried to set default user when calling the next webservice and tried without setting any user (thinking that it will use the user already log in).

    But now I'm setting the user credentials for the user to the webservice and then I get this error instead:

    rtg16x2o047r.png
  • Lefteyed
    Lefteyed Member Posts: 43
    Answer ✓
    Mismatch in our wsdl from test enviorment to customers enviorment was the cause of error with "The target principal name is incorrect".

    Everything seems to work fine by now. :smile:

Answers

  • AK
    AK Member Posts: 226
    Are both webservices within the same NAV instance/database?
  • Lefteyed
    Lefteyed Member Posts: 43
    Yes
  • Lefteyed
    Lefteyed Member Posts: 43
    Answer ✓
    When calling the first webservice there was no problem with AD user.
    Tried to set default user when calling the next webservice and tried without setting any user (thinking that it will use the user already log in).

    But now I'm setting the user credentials for the user to the webservice and then I get this error instead:

    rtg16x2o047r.png
  • Lefteyed
    Lefteyed Member Posts: 43
    Answer ✓
    Mismatch in our wsdl from test enviorment to customers enviorment was the cause of error with "The target principal name is incorrect".

    Everything seems to work fine by now. :smile: