Using the Soap module in Nodejs (via loopback-connector-soap), I'm trying to convert json to xml for my soap request, but I have a few problems...
What it is:
<ns:UserDefinedFields>
<ns:UserDefinedField>
<ns:displayName>Campaign?</ns:displayName>
<ns:fieldValue>Yes</ns:fieldValue>
</ns:UserDefinedField>
</ns:UserDefinedFields>
<ns:UserDefinedFields>
<ns:UserDefinedField>
<ns:displayName>Anticipated Use</ns:displayName>
<ns:fieldValue>6</ns:fieldValue>
</ns:UserDefinedField>
What it should be:
<ns:UserDefinedFields>
<ns:UserDefinedField>
<base:displayName>Campaign?</base:displayName>
<base:fieldValue>Yes</base:fieldValue>
</ns:UserDefinedField>
<ns:UserDefinedField>
<base:displayName>Anticipated Use</base:displayName>
<base:fieldValue>6</base:fieldValue>
</ns:UserDefinedField>
</ns:UserDefinedFields>
- Should be only one
<ns:UserDefinedFields>
- And should be
<base:fieldValue>
instead of<ns:fieldValue>
Any advice would be super helpful! Thanks!
The XML:
{
...
"UserDefinedFields": [
{
"displayName": "Campaign?",
"fieldValue": "Yes"
},
{
"displayName": "Anticipated Use",
"fieldValue": 6
}
]
...
}
The XSD:
...
<xs:element name="UserDefinedFields" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="UserDefinedField" type="base:UserDefinedFieldType" minOccurs="0" maxOccurs="15"/>
</xs:sequence>
</xs:complexType>
</xs:element>
...
<base:displayName></ns:displayName>
. What you callThe XML
looks like JSON. – Gatesns
in your XML is pointing to the same namespace asbase
in your XSD, everything is fine. The question does not contain enough information to judge about this. Please add thexmlns:ns=
andxmlns:base=
parts. – Gates