ExitLastCustomer(parametro : Text[30]) : Integer CLEAR(Customer); Customer.RESET; Customer.SETRANGE("Customer No.",parametro); Customer.FINDLAST; EXIT(Customer."Entry No.");3. I created a CU that should consume this WS
IF ISCLEAR(XMLDoc) THEN CREATE(XMLDoc); XMLDoc.async := FALSE; XMLDoc.load('C:\Input2.xml'); IF ISCLEAR(XMLHttp) THEN CREATE(XMLHttp); XMLHttp.open('POST','http://localhost:7047/DynamicsNAV/WS/Riktest/Codeunit/ExitLastCustomerWSName',0); XMLHttp.setRequestHeader('Content-type','text/xml'); XMLHttp.setRequestHeader('SOAPAction','ExitLastCustomer'); XMLHttp.send(XMLDoc); XMLDoc.load(XMLHttp.responseXML); XMLDoc.save('C:\temp.xml'); XMLDoc.load(XMLHttp.responseBody); XMLNode := XMLDoc.selectSingleNode('//Soap:Envelope/Soap:Body/ExitLastCustomer_Result/return_value/'); MESSAGE(XMLNode.text);this is the Input2.xml file
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:nav="urn:microsoft-dynamics-schemas/codeunit/NAVWebServices" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/> <soap:Body> <nav:ExitLastCustomer> <nav:parametro>10000</nav:parametro> </nav:ExitLastCustomer> </soap:Body> </soap:Envelope>to do what I did I followed this links:
Answers
You create below method in your codeunit (as web service).
ExitLastCustomer(parametro : Text[30]) : Integer
When you are using this web service you must pass the parameters for the method.
e.g. C# .net code
Testcodeunit Service_Testcodeunit = new Testcodeunit();
Service_Testcodeunit.UseDefaultCredentials = true;
Service_Testcodeunit.Url = sNAV_DT_RDNPath.Trim() + "/Codeunit/Testcodeunit";
Service_Testcodeunit.ExitLastCustomer('100000000');
If you read the previous peace of code you can see that I try to pass a value to parametro...
It works as expected... More or Less...
It works as expected... More or Less...