[solved] Problem setting up the webservice

lape
Member Posts: 19
Hi there,
I have problem calling the webservice on NAV2009 R2.
I Installed the service on the same machine the sql server is installed.
I set up a WS in Form 810 and published it.
The service is running and I can open the service wsdl http://[servername]:7047/DynamicsNAV/WS/Services | http://[servername]:7047/DynamicsNAV/WS/[company]/Page/WSCustomer
I downloaded the xml and imported it in soapui.
When I submit the request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="urn:microsoft-dynamics-schemas/page/WSCustomer">
<soapenv:Header/>
<soapenv:Body>
<cus:Read>
<cus:No>0000001</cus:No>
</cus:Read>
</soapenv:Body>
</soapenv:Envelope>
I get the result
#status# HTTP/1.1 401 Unauthorized.
I also set the Authorization to Basic entered a username / password of a user whitch is known in nav and has the role super.
Has anyone any idea?
I have problem calling the webservice on NAV2009 R2.
I Installed the service on the same machine the sql server is installed.
I set up a WS in Form 810 and published it.
The service is running and I can open the service wsdl http://[servername]:7047/DynamicsNAV/WS/Services | http://[servername]:7047/DynamicsNAV/WS/[company]/Page/WSCustomer
I downloaded the xml and imported it in soapui.
When I submit the request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="urn:microsoft-dynamics-schemas/page/WSCustomer">
<soapenv:Header/>
<soapenv:Body>
<cus:Read>
<cus:No>0000001</cus:No>
</cus:Read>
</soapenv:Body>
</soapenv:Envelope>
I get the result
#status# HTTP/1.1 401 Unauthorized.
I also set the Authorization to Basic entered a username / password of a user whitch is known in nav and has the role super.
Has anyone any idea?
0
Best Answers
-
I changed the CunstomSerrings.config in the Service folder:
from
<add key="WebServicesUseNTLMAuthentication" value="false"></add>
to
<add key="WebServicesUseNTLMAuthentication" value="true"></add>
I restarted the NAV Services (Business Webservice and Server)
Then I did the same I described above
...
http://[myserver]:7047/DynamicsNAV/WS/Page/WSCust
Download the result as xml
Changed the Company (ReplaceWithAPercentEncodedCompanyName)
Create new soap in soapui, select the xml, ok
create a new read request
changed the customer no
<wsc:No>?</wsc:No>
-> <wsc:No>0000001</wsc:No>
select Auth -> add new -> ntlm
username
password
(domain)
-> fire
#status# HTTP/1.1 401 Unauthorized
Server Microsoft-HTTPAPI/2.0
Content-Length 0
Date Thu, 18 Apr 2019 05:59:23 GMT
WWW-Authenticate Negotiate0 -
Hello @lape,
Well I don't know what to say, after the change for the "WebServicesUseNTLMAuthentication" value, it works for me.
Maybe you must check if you have more the one service runnig, because after the change the error message if there is a Authetication problem must be:
WWW-Authenticate NTLM
No
WWW-Authenticate Negotiate.
Regards1
Answers
-
SoapUI does not deal well with the Authentication used by NAV.
You can try this Powershell script to test the connection:$username = "user" $password = "password*" $URI = "your_URL" $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force)) $WSProxy = New-WebServiceProxy -Uri $URI -Credential $cred $WSProxy.Read('0000001')
Regards1 -
this works fine but why does soapui fail?0
-
It does if you enable NTLM authentication in the services configuration.1
-
Hello @Duikmeester ,
Thank you, it works, the true is that I don't use SoapUI much because I test WS with Powershell or XMLSpy.
Regards.1 -
I Configured the webservice that ntlm is used unfortunately it doesnt work.0
-
I changed the CunstomSerrings.config in the Service folder:
from
<add key="WebServicesUseNTLMAuthentication" value="false"></add>
to
<add key="WebServicesUseNTLMAuthentication" value="true"></add>
I restarted the NAV Services (Business Webservice and Server)
Then I did the same I described above
...
http://[myserver]:7047/DynamicsNAV/WS/Page/WSCust
Download the result as xml
Changed the Company (ReplaceWithAPercentEncodedCompanyName)
Create new soap in soapui, select the xml, ok
create a new read request
changed the customer no
<wsc:No>?</wsc:No>
-> <wsc:No>0000001</wsc:No>
select Auth -> add new -> ntlm
username
password
(domain)
-> fire
#status# HTTP/1.1 401 Unauthorized
Server Microsoft-HTTPAPI/2.0
Content-Length 0
Date Thu, 18 Apr 2019 05:59:23 GMT
WWW-Authenticate Negotiate0 -
Hello @lape,
Well I don't know what to say, after the change for the "WebServicesUseNTLMAuthentication" value, it works for me.
Maybe you must check if you have more the one service runnig, because after the change the error message if there is a Authetication problem must be:
WWW-Authenticate NTLM
No
WWW-Authenticate Negotiate.
Regards1 -
That was a helpful hint!
I can't see a second service but after changeing the port in the config the authentication works well.
Now there is another Problem:<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <s:Fault> <faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:System.Net.WebException</faultcode> <faultstring xml:lang="de-DE">Soap message is invalid!</faultstring> <detail> <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Soap message is invalid!</string> </detail> </s:Fault> </s:Body> </s:Envelope>
but for this there seems to be a hotfix (no longer available)
0 -
Hello @lape,
If with the Plowershell script the WS works, that means that the problem must be with the XML that you are sending..
Try this, in this line change the cus urn to all lowercase<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:cus="urn:microsoft-dynamics-schemas/page/WSCustomer">
Like this:<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:cus="urn:microsoft-dynamics-schemas/page/wscustomer">
That it is how the SoapUI version I use do it.
Regards.
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions