web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Parse and read a soap responseXML in Dynamic CRM from javascript

(0) ShareShare
ReportReport
Posted on by 420

Hi All,

I have construct one soapBody message to retreive the some attributes. I am getting the responseXML. How to parse and read the values in that resultXML. Friends please give your suggestion and ways.

Regards

Felix

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Pedro Azevedo Profile Picture
    830 User Group Leader on at

    Hi,

    I don't know the request, so it's more difficult to answer but try use this:

    resultXml.selectSingleNode("//q1:" + columns).attributes[0].text;

    or

    resultXml.selectNodes("//BusinessEntity/q1:" + pAttributeName);

    or

    var v = xmlObj.childNodes(0).getAttribute("id");

    In this example you can see how Microsoft read the responses:

  • Felix Xavier Profile Picture
    420 on at

    Hi Pedro

    this is my soap request

    <?xml version='1.0' encoding='utf-8'?>

    <soap:Envelope xmlns:soap='schemas.xmlsoap.org/.../&  xmlns:xsi='www.w3.org/.../XMLSchema-instance&  xmlns:xsd='www.w3.org/.../XMLSchema&

    </soap:Header>  

    <soap:Body>  

    <Retrieve xmlns='schemas.microsoft.com/.../WebServices&  

       <entityName>systemuser</entityName>  

    <id>{EA155D45-3245-U243-84CB-1CC1DE6E4B9C}</id>

    <columnSet xmlns:q1='schemas.microsoft.com/.../Query& xsi:type='q1:ColumnSet'>        <q1:Attributes>      

      <q1:Attribute>new_jusername</q1:Attribute>        

     <q1:Attribute>new_jpassword</q1:Attribute>          

    </q1:Attributes>    

    </columnSet>  

    </Retrieve>  

    </soap:Body>

    </soap:Envelope>

    how to retrieve the username and password attributes?

    Regards

    Felix

  • Suggested answer
    Pedro Azevedo Profile Picture
    830 User Group Leader on at

    Hi,

    Like that (you have to change the name of request):

    var errorCount = resultXml.selectNodes('//error').length;

    var resultXml = xmlHttpRequest.responseXML;

    var username = resultXml.selectSingleNode("//q1:new_jusername").nodeTypedValue;

    var pass = resultXml.selectSingleNode("//q1:new_jpassword").nodeTypedValue;

  • Felix Xavier Profile Picture
    420 on at

    Hi,

    I have applied the above code, but it shows this error message " resultXml.selectNodes is not a function" . how to resolve that error.

    Thanks

    Felix

  • Pedro Azevedo Profile Picture
    830 User Group Leader on at

    Hi,

    Can you put here the rest of method where you execute the request.

  • Felix Xavier Profile Picture
    420 on at

    hi

    this way i am calling the request

     httpObj = new ActiveXObject("Msxml2.XMLHTTP");

     httpObj.open("POST", serviceUrl, false);

     httpObj.setRequestHeader("SOAPAction",soapActionHeader);

     httpObj.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

     httpObj.setRequestHeader("Content-Length", xmlReq.length);

     httpObj.send(xmlReq);

    //var errorCount = resultXml.selectNodes('//error').length;

    //var resultXml = xmlHttpRequest.responseXML;

    var resultXml = httpObj.responseXML;

    alert("After the result XML "+resultXml .toString() + " ::::");

    var username = resultXml.selectSingleNode("//q1:new_jabberusername").nodeTypedValue;

    var pass = resultXml.selectSingleNode("//q1:new_jabberpassword").nodeTypedValue;

  • Pedro Azevedo Profile Picture
    830 User Group Leader on at

    With the code you post is giving any error?

  • Felix Xavier Profile Picture
    420 on at

    this error i got " resultXml.selectNodes is not a function" .

  • Suggested answer
    Pedro Azevedo Profile Picture
    830 User Group Leader on at

    Ok but you have the line

    var resultXml = httpObj.responseXML;

    After

    var errorCount = resultXml.selectNodes('//error').length;

    So the compiler doesn't know the type of resultXml.

  • Felix Xavier Profile Picture
    420 on at

    So what is the solution? , i am new to this dynamic CRM  pls

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans