Call Function in Codeunit with Webservice

Florian48S
Member Posts: 1
Hello I want to HTTP Post from one NAV DB to another with Webservice.
I created the webservice entry in the one and the function on the HTTP Client.
When I start this function I receive status code 500 Error.
My URI is like:
http://server:port/instance/WS/companyname/Codeunit/webservicename:codeunitfunctionname
When I try to do the same with the same URI except I delete :codeunitfunctionname I receive status code 200 OK.
But then it does nothing because I need to call the codeunit function.
What is wrong??
Here the Code from the HttpClient:
Uri := Uri.Uri('http://server:port/instance/WS/companyname/Codeunit/webservicename:codeunitfunctionname');
HttpHandler := HttpHandler.HttpClientHandler;
NCredentials := NCredentials.NetworkCredential(username,password);
HttpHandler.Credentials(NCredentials);
HttpClient := HttpClient.HttpClient(HttpHandler);
StringContent := StringContent.StringContent(txtResult,Encoding.UTF8,'application/xml');
ResponseMessage := HttpClient.PostAsync(Uri,StringContent).Result;
And here is the Function I want to POST to:

Here is the error in the Event viewer on the Server I POST to:

Or is there a problem with the firewall or on the server?
The two NAV's are in the same Domain but different servers.
I created the webservice entry in the one and the function on the HTTP Client.
When I start this function I receive status code 500 Error.
My URI is like:
http://server:port/instance/WS/companyname/Codeunit/webservicename:codeunitfunctionname
When I try to do the same with the same URI except I delete :codeunitfunctionname I receive status code 200 OK.
But then it does nothing because I need to call the codeunit function.
What is wrong??
Here the Code from the HttpClient:
Uri := Uri.Uri('http://server:port/instance/WS/companyname/Codeunit/webservicename:codeunitfunctionname');
HttpHandler := HttpHandler.HttpClientHandler;
NCredentials := NCredentials.NetworkCredential(username,password);
HttpHandler.Credentials(NCredentials);
HttpClient := HttpClient.HttpClient(HttpHandler);
StringContent := StringContent.StringContent(txtResult,Encoding.UTF8,'application/xml');
ResponseMessage := HttpClient.PostAsync(Uri,StringContent).Result;
And here is the Function I want to POST to:

Here is the error in the Event viewer on the Server I POST to:

Or is there a problem with the firewall or on the server?
The two NAV's are in the same Domain but different servers.
0
Answers
-
Hi,
Did you test the webservice calls with a 3rd party soap client first? such as POSTMAN or Chrome boomerang extension? This will eliminate any firewall related issues.0 -
Hi,
As I see from error, it can be internal error on database that you tries to connect (means something going wrong in procedure that you calling saveXML as I see) maybe this procedure was not have
External property because message said that saveXML procedure as not found.
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