We need to call the SOAP direct update call and the soap message contains attributes and name spaces. While constructing the SOAP message from REST message, we are facing issue. The SOAP message contains attributes like below and the index keep on increasing. SOAP message: <input z:Id="i1" i:type="Person" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"> <Addresses> <Address z:Id="i2"> <City>NLanarkshorth ire</City> <Country>.</Country> <County>.</County> <ID>123456</ID> <IsDefault>true</IsDefault> <ItemValidMethod>Unspecified</ItemValidMethod> <Line1> St</Line1> <Line2>well</Line2> </Address> </Addresses> <CreatedDate>2016-08-12T21:20:25.437</CreatedDate> <Emails> <Email z:Id="i3"> <Address>123@gmail.com</Address> <ID>12434</ID> <IsDefault>true</IsDefault> <PartyID>123</PartyID> <Purpose>Employment</Purpose> </Email> </Emails> I tried as per below REST to SOAP conversion suggested by Apigee, getting error due to z:Id . "Addresses":{ "Address":{ "#attrs":{ "@z:Id":"i2" },
Error getting like unspecified attribute _z. Please help.
Solved! Go to Solution.
I didn't find any problem converting that XML to JSON (using default settings)
<input z:Id="i1" i:type="Person" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"> <Addresses> <Address z:Id="i2"> <City>NLanarkshorth ire</City> <Country>.</Country> <County>.</County> <ID>123456</ID> <IsDefault>true</IsDefault> <ItemValidMethod>Unspecified</ItemValidMethod> <Line1> St</Line1> <Line2>well</Line2> </Address> </Addresses> <CreatedDate>2016-08-12T21:20:25.437</CreatedDate> <Emails> <Email z:Id="i3"> <Address>123@gmail.com</Address> <ID>12434</ID> <IsDefault>true</IsDefault> <PartyID>123</PartyID> <Purpose>Employment</Purpose> </Email> </Emails> </input>
Output:
{ "input": { "@xmlns": { "i": "http://www.w3.org/2001/XMLSchema-instance", "z": "http://schemas.microsoft.com/2003/10/Serialization/" }, "@z:Id": "i1", "@i:type": "Person", "Addresses": { "Address": { "@z:Id": "i2", "City": "NLanarkshorth\nire", "Country": ".", "County": ".", "ID": 123456, "IsDefault": true, "ItemValidMethod": "Unspecified", "Line1": " St", "Line2": "well" } }, "CreatedDate": "2016-08-12T21:20:25.437", "Emails": { "Email": { "@z:Id": "i3", "Address": "123@gmail.com", "ID": 12434, "IsDefault": true, "PartyID": 123, "Purpose": "Employment" } } } }