XML responsetext

gunavsgunavs Member Posts: 32
I am consuming a webservice by doing a string query POST and get the response back in xmlhttp.responsetext. Unfortunately for some situations i get a response text greater than 1024 characters which i cannot directly load into a navision string. Is there anyway i can load this responsetext somewhere else and not get a string buffer error?

Thank You!

I have Navision 3.7 so i do not have Bigtext or Blobs to load it into.

Comments

  • ara3nara3n Member Posts: 9,256
    use xmlhttp.responsebody


    XMLDOC.LOAD(xmlhttp.responsebody);


    http://mibuso.com/blogs/ara3n/2009/02/1 ... nitiative/
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gunavsgunavs Member Posts: 32
    Thanks ara3n. I tried doing that


    XMLDoc.load(XMLReq.responseBody);
    XMLDoc.save('C:\response1.xml');

    Also the
    XMLDoc.load(XMLReq.responseXML);

    But the file is always empty. Only the responsetext had the return information from the webservice though it was exceeding 1024 characters for a few responses. Do i need to do any additional intital settings then what i have below


    XMLReq.open('POST', 'url', FALSE);
    XMLReq.setRequestHeader('Content-type','text/xml');
    XMLReq.send(String);

    The webservice only accepts query strings so i am not posting a .xml
    Thanks again!!
  • ara3nara3n Member Posts: 9,256
    add this code to see why xmldoc couldn't parse the xml file


    IF XMLDoc.parseError.errorCode <> 0 THEN
    ERROR('XML DOM Error: ' +XMLDoc.parseError.reason +' - Errorcode : '+FORMAT(XMLDoc.parseError.errorCode));
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    also what is the subtype for xmldoc variable?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gunavsgunavs Member Posts: 32
    I get a "Invalid at the top level of the documet- Error code :- 1072896682."

    Also my XmlDoc is 'Microsoft XML, v6.0'.DOMDocument60

    Thank You ara3n
  • ara3nara3n Member Posts: 9,256
    Change it to

    Microsoft XML, v6.0'.DOMDocument


    don't use

    DOMDocument60
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gunavsgunavs Member Posts: 32
    I am still getting the invalid at the top level error. Thanks ara3n
  • ara3nara3n Member Posts: 9,256
    I suggest to download and install SOAPUI and test your webservice and make sure it returns the valid info.

    It looks like the webservice is return an invalid xml file.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gunavsgunavs Member Posts: 32
    But is there anyway i can load the XMLresponsetext somewhere without getting a string buffer error? I was going to invoke a SHELL command a copy this string into a empty file but i am not sure how to go about it or if it woulr still give me the buffer error. How did navision 3.7 handle huge strings when it did not have Bigtext and Blobs?

    Thank You ara3n. I will check why my xmlresponsetext is fine and the xml is invalid.
  • gunavsgunavs Member Posts: 32
    I checked and the web dll i am communicating with accepts an HTTP post, and not the WSDL functionality. Si get get only a string response since it is a http post?
  • ara3nara3n Member Posts: 9,256
    If a string is being returned back, then the only workaround is write your code in .NET and make a dll.

    The other option is run your code using 2009 service tier and use variant type.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gunavsgunavs Member Posts: 32
    I will try that. Thank You.
Sign In or Register to comment.