Error using NAS: The data necessary to complete this operati

DRBDRB Member Posts: 105
Error while using NAS:
I am getting following error while running the code using NAS (Navision Application Server), whereas the code is working fine when run from the codeunit manually (without scheduling using NAS):
This message is for C/AL programmers:The call to member responseStream failed. msxml6.dll returned the following message: The data necessary to complete this operation is not yet available.
Following is the code:
CREATE(oXML);
CREATE(pDOM);
oXML.open('POST', URL, TRUE);
oXML.setRequestHeader('User-Agent', "User Agent");
oXML.setRequestHeader('Content-Type', 'text/xml');
oXML.setRequestHeader('Protocol', 'HTTP/1.1');
oXML.send(pDOM.xml);
WHILE (oXML.readyState() <> 4) AND (x < 600) DO
BEGIN
Do some simple processing//
END;
pDOM.load(oXML.responseStream);

Var Name DataType Subtype Length
Yes pDOM Automation 'Microsoft XML, v6.0'.DOMDocument60
oXML Automation 'Microsoft XML, v6.0'.XMLHTTP60

Please suggest.
-Dhan Raj Bansal
Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal

Answers

  • Dirk.FischerDirk.Fischer Member Posts: 11
    At First it sounds like the automation server (XMLHTTP60) is not in the right version on the server where the NAS is running. The "responseStream" is first mentionened in the last line, right? So the other members of oXML all seem to work.
    The second possibility I see is, that there is really no response stream reaching the server. Is the response of the xml request addressed correctly?
    Did you try debugging the NAS and for example moving the response stream to a variable where you can look at it?
  • DRBDRB Member Posts: 105
    At First it sounds like the automation server (XMLHTTP60) is not in the right version on the server where the NAS is running. The "responseStream" is first mentionened in the last line, right? So the other members of oXML all seem to work.
    The second possibility I see is, that there is really no response stream reaching the server. Is the response of the xml request addressed correctly?
    Did you try debugging the NAS and for example moving the response stream to a variable where you can look at it?

    I am using NAS and manual part both on the same machine. The above code is a function, which is part of full code, while running the codeunit from object designer, it is sending and getting the proper response, whereas If I use Job Queue and NAS it gives error.

    I tried using NASHandler function in a codeunit and then also it is running properly.
    -Dhan Raj Bansal
    Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal
  • kinekine Member Posts: 12,562
    Try to use
    oXML.open('POST', URL, FALSE);
    
    instead
    oXML.open('POST', URL, TRUE);
    

    It will call the send in synchronous mode, not asynchronous, thus you do not need to check the state etc. The send will end after the sending will finish etc. It could help you.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DRBDRB Member Posts: 105
    kine wrote:
    Try to use
    oXML.open('POST', URL, FALSE);
    
    instead
    oXML.open('POST', URL, TRUE);
    
    Thanks Kamil, that solved the issue
    -Dhan Raj Bansal
    Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal
  • DRBDRB Member Posts: 105
    btw, how do we change the status of post/ question to solved on mibuso?
    Can the mods please do this and let me know for future?
    -Dhan Raj Bansal
    Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal
  • kinekine Member Posts: 12,562
    DRB wrote:
    btw, how do we change the status of post/ question to solved on mibuso?
    Can the mods please do this and let me know for future?
    You need to edit the first post and add the "Solved" flag. It was already described when the new forum version was started. Just look at edit page of the first post... (green check mark)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.