Options

webservice xml

gonzy1981gonzy1981 Member Posts: 156
edited 2015-07-07 in NAV Three Tier
Hi experts,
I've created a codeunit which calles to an external webservice, that webservice get my back a xml as a parameter (no physical xml file). So, with that parameter (xml) I'm calling to my xmlport because I want to import that information in a NAV table.

So I'm doing this
..
..
HttpWebRequest := HttpWebRequest.Create(ServiceUrl);
HttpWebRequest.Method := 'GET';
HttpWebRequest.Headers.Add('Authorization','Basic ' + Convert.ToBase64String(Encoding.ASCII.GetBytes(GlobalUsername + ':' + GlobalPassword)));
HttpWebResponse := HttpWebRequest.GetResponse;
ResponseInStream := HttpWebResponse.GetResponseStream;

CLEAR(OnlineXML);
OnlineXML.SETSOURCE(ResponseInStream);
OnlineXML.IMPORT;

The webservice is working fine, because I receive the InStream properly. But the system breaks down in the OnlineXML.IMPORT.

Am I calling properly to the xmlport??? Do you know what am I doing wrong??
Thanks

Comments

  • Options
    gonzy1981gonzy1981 Member Posts: 156
    I forgot to say that this is in NAV 2015
  • Options
    vaprogvaprog Member Posts: 1,118
    Your code looks fine.

    I suggest, in order to sort things out you dump the response to a file, then make sure it is a valid xml file in the first place. Then make sure, your XMLport works on that response file.
Sign In or Register to comment.