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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

JSON Response using XML2Json for a SOAP call is having a extra "s:" in body.

(0) ShareShare
ReportReport
Posted on by

I have noticed that when I am trying to retrieve an option set using SOAP call, it is working fine in Chrome using below code from a HTML web resource.

RetrieveAttributeMetadata: function (entityLogicalName, logicalName, metadataId, retrieveAsIfPublished) {
 
    //console.log(EntityLogicalName + "-" + " " + LogicalName);
    var request = "<request i:type=\"a:RetrieveAttributeRequest\" xmlns:a=\"schemas.microsoft.com/.../Contracts\">";
    request += "<a:Parameters xmlns:b=\"schemas.datacontract.org/.../System.Collections.Generic\">";
    request += "<a:KeyValuePairOfstringanyType>";
    request += "<b:key>EntityLogicalName</b:key>";
    request += "<b:value i:type=\"c:string\" xmlns:c=\"www.w3.org/.../XMLSchema\">" + entityLogicalName + "</b:value>";
    request += "</a:KeyValuePairOfstringanyType>";
    if (metadataId == null) {
        metadataId = "00000000-0000-0000-0000-000000000000";
    }
    request += "<a:KeyValuePairOfstringanyType>";
    request += "<b:key>MetadataId</b:key>";
    request += "<b:value i:type=\"ser:guid\"  xmlns:ser=\"schemas.microsoft.com/.../Serialization\">" + metadataId + "</b:value>";
    request += "</a:KeyValuePairOfstringanyType>";
    request += "<a:KeyValuePairOfstringanyType>";
    request += "<b:key>RetrieveAsIfPublished</b:key>";
    request += "<b:value i:type=\"c:boolean\" xmlns:c=\"www.w3.org/.../XMLSchema\">" + retrieveAsIfPublished + "</b:value>";
    request += "</a:KeyValuePairOfstringanyType>";
    request += "<a:KeyValuePairOfstringanyType>";
    request += "<b:key>LogicalName</b:key>";
    request += "<b:value i:type=\"c:string\"   xmlns:c=\"www.w3.org/.../XMLSchema\">" + logicalName + "</b:value>";
    request += "</a:KeyValuePairOfstringanyType>";
    request += "</a:Parameters>";
    request += "<a:RequestId i:nil=\"true\" /><a:RequestName>RetrieveAttribute</a:RequestName></request>";
    var res = XrmServiceToolkit.Soap.Execute(request);
 
    var jsonOptions = $.xml2json(res);
 
    return jsonOptions.Body.ExecuteResponse.ExecuteResult.Results.KeyValuePairOfstringanyType.value.OptionSet.Options.OptionMetadata;
 
}

However when I execute same code in IE 11, it is giving an error that Body in jsonOptions.Body in undefined. IE F12 shows the issue that Body schema is coming as s:Body, and hence undefined in above function.
When I execute the same code in a different CRM instance in same IE, it working fine and Body in jasonOptions is coming without any prefix schema. Can some one help me, to how we can fix it.


Issue:
2018_2D00_03_2D00_08_5F00_17_2D00_45_2D00_14.png

Working:
normal.png

*This post is locked for comments

I have the same question (0)
  • Sachin Dev Gupta Profile Picture
    on at

    Error in IE:

    2018_2D00_03_2D00_08_5F00_17_2D00_59_2D00_27.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans