Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Invoking webservices using dotnet variables

$
0
0
Hi experts ,
I found below link for invoking webservices
http://codeverge.com/asp.net.handlers-m ... ttp/211661
Dim oURI As New System.Uri(msURL)
        Dim oRequest As HttpWebRequest
        oRequest = CType(WebRequest.CreateDefault(oURI), HttpWebRequest)
        oRequest.Method = "POST"
        oRequest.ContentType = "text/html"
        oRequest.KeepAlive = True
        oRequest.Timeout() = miConnectorTimeout
        oRequest.Credentials = New NetworkCredential(msUserID, msPassword)
        Dim oResponse As HttpWebResponse
        oRequest.ContentLength = sHeader.Length
        Dim oStream As New StreamWriter(oRequest.GetRequestStream, Encoding.ASCII)
        oStream.Write(sHeader)
        oStream.Close()
        oResponse = CType(oRequest.GetResponse, HttpWebResponse)
        If oResponse.StatusCode = 200 Then
            Dim oReader As New StreamReader(oResponse.GetResponseStream)
            Return oReader.ReadToEnd
        ElseIf oResponse.StatusCode = 401 Then
            Return "Unauthorized"
        End If
I have mapped navision code as follows
msURL := 'http://tempuri.org/sometext';
Ouri := Ouri.Uri(msURL);
//oRequest = (HttpWebRequest)WebRequest.CreateDefault(oURI);
oRequest.Method := 'POST';
oRequest.ContentType := 'text/html'; //'XML'
oRequest.KeepAlive := TRUE;
oRequest.Timeout := 10;
oRequest.Credentials(NetworkCredential);
oRequest.ContentLength := 1024;
oStream := oStream.StreamWriter(oRequest.GetRequestStream);
oStream.Write('demo');
oStream.Close;
//oResponse = CType(oRequest.GetResponse, HttpWebResponse)

IF oResponse.StatusCode = 200 THEN BEGIN
 oReader := oReader.StreamReader(oResponse.GetResponseStream);
  oReaderReadtoend := oReader.ReadToEnd ;
END ELSE
 IF oResponse.StatusCode = 401 THEN BEGIN

   MESSAGE('Unauthorized');
END;
How can I map below 2 lines code in navision which containing typecasting

oRequest = (HttpWebRequest)WebRequest.CreateDefault(oURI);
oResponse = CType(oRequest.GetResponse, HttpWebResponse);
where variables are given below
Name	DataType	Subtype	Length
oRequest	DotNet	System.Net.HttpWebRequest.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
oResponse	DotNet	System.Net.HttpWebResponse.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
Ouri	DotNet	System.Uri.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
msURL	Text		
NetworkCredential	DotNet	System.Net.NetworkCredential.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
oStream	DotNet	System.IO.StreamWriter.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
oReader	DotNet	System.IO.StreamReader.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
oReaderReadtoend	Text		

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>