Skip to main content

Notifications

Announcements

No record found.

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

  • 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans