Hello,
My customer uses NAV2017 version and wants to call a "webservice" published by a parter and this webservice uses Post and Get methods.
I've searched and tried to use standard codeunit 1297 and my code was something like this:
ltxtUrl := STRSUBSTNO(STRSUBSTNO(ltxtAddress,'1',pRecContact."E-Mail"));
lCduHttpWebRequestMgt.Initialize(ltxtUrl);
lCduHttpWebRequestMgt.DisableUI;
lCduHttpWebRequestMgt.SetMethod('GET');
lCduHttpWebRequestMgt.SetReturnType('application/xml');
lCduHttpWebRequestMgt.SetContentType('application/xml');
lCduHttpWebRequestMgt.GetResponse(lInStreamResponse,HttpStatusCode,ResponseHeaders);
When I call this method I get the error message" Authentication failed because the remote party has closed the transport stream."
I've searched a little more and developed an dll and consumed on NAV.
The dll code is something like this
public void GetConsent(string pChannelId, string pChannelValue)
{
string Url = GetConsentUrl + HashToken + "?idClient=" + IdClient + "&idChannel=" + pChannelId + "&channelValue=" + pChannelValue;
WebRequest webRequest = WebRequest.Create(Url);
WebResponse webResponse = webRequest.GetResponse();
Stream responseStream = webResponse.GetResponseStream();
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.Load(responseStream);
}
Now the "funny thing" is that when I run this methode on Visual Studio it wotks fine and I can get a corret answer and load the responsestream.
On other hand when I publish my dll and try to call it form NAV I get the same error message "...Authentication failed because the remote party has closed the transport stream."
Can anyone has an idea why its does not work on NAV?
0
Answers