I wrote a blog post about calling external web services from Nav, which you can find here. I was asked, how in detail variable reqText works. reqText is the xml value, which is given to the web service as parameter value. For that i developed a simple web service in c#.

 namespace WebServiceNS  
   [WebService(Namespace = "")]  
   [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
   public class WebService1 : System.Web.Services.WebService  
     public string GetUpperCase(string lowerCaseText)  
       if (!string.IsNullOrEmpty(lowerCaseText))  
         return lowerCaseText.ToUpper();  
       return string.Empty;  

Then i ran the new webservice from Visual Studio with http://localhost:63427/WebService1.asmx?op=GetUpperCase. The port is, as you may know, dynamically set by Visual Studio.

In the browser window you can then see then the wsdl code:
POST /WebService1.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: “”

 <?xml version="1.0" encoding="utf-8"?>  
 <soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">  
   <GetUpperCase xmlns="">  

To call the web service with c/al and set the correct value for reqText, simply copy the lines between the soap:Body tag and paste it to your c/al.
So the value for reqText in that case is:

 reqText := '<GetUpperCase xmlns=""><lowerCaseText>hello</lowerCaseText></GetUpperCase>';  

GetUpperCase is the webmethod name , tag property xmlns is set with the namespace defined as attribute in the c# webmethod. lowercasetext is the name of the parameter. So it’s quite simple to use.

The result, when calling that web service:

 <GetUpperCaseResponse xmlns=""><GetUpperCaseResult>HELLO</GetUpperCaseResult></GetUpperCaseResponse>  

You can see: hello is converted to HELLO..😉




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s