Skip to main content

Notifications

Announcements

No record found.

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

  • Sachin Dev Gupta Profile Picture
    on at
    RE: JSON Response using XML2Json for a SOAP call is having a extra "s:" in body.

    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans