Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle xsi:type for subtype mappng from json to xml
See #141
- Loading branch information
1 parent
153acf6
commit 07b0d30
Showing
9 changed files
with
156 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/request-response-samples/addList__xsi_type/request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"record": [ | ||
{ | ||
"id": "1", | ||
"name": "John", | ||
"$attributes": { | ||
"$xsiType": "{urn:example}NameRecord" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header/><soap:Body><ns1:addList xmlns:ns1="urn:example"><ns1:record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:example" xsi:type="ns2:NameRecord"><ns1:id>1</ns1:id><ns1:name>John</ns1:name></ns1:record></ns1:addList></soap:Body></soap:Envelope> |
9 changes: 9 additions & 0 deletions
9
test/request-response-samples/addList__xsi_type/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"record": { | ||
"$attributes": { | ||
"$xsiType": { "type": "UserRecord", "xmlns": "urn:example" } | ||
}, | ||
"id": "2", | ||
"name": "Mary" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/request-response-samples/addList__xsi_type/response.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > | ||
<soapenv:Header/> | ||
<soapenv:Body> | ||
<ns1:addListResponse xmlns:ns1="urn:example" xmlns:ns2="urn:example"> | ||
<ns1:record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:UserRecord"> | ||
<ns1:id>2</ns1:id> | ||
<ns1:name>Mary</ns1:name> | ||
</ns1:record> | ||
</ns1:addListResponse> | ||
</soapenv:Body> | ||
</soapenv:Envelope> |
38 changes: 38 additions & 0 deletions
38
test/request-response-samples/addList__xsi_type/soap.messages.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schema xmlns="http://www.w3.org/2001/XMLSchema" | ||
xmlns:msgs="urn:example" | ||
targetNamespace="urn:example" | ||
elementFormDefault="qualified" attributeFormDefault="qualified"> | ||
|
||
<complexType name="AddListResponse"> | ||
<sequence> | ||
<element name="record" minOccurs="1" maxOccurs="unbounded" type="msgs:Record"/> | ||
</sequence> | ||
</complexType> | ||
|
||
<element name="addListResponse" type="msgs:AddListResponse"/> | ||
|
||
<complexType name="AddListRequest"> | ||
<sequence> | ||
<element name="record" type="msgs:Record" minOccurs="1" maxOccurs="unbounded"/> | ||
</sequence> | ||
</complexType> | ||
|
||
<complexType name="Record"> | ||
<sequence> | ||
<element name="id" type="string"/> | ||
</sequence> | ||
</complexType> | ||
|
||
<complexType name="NameRecord"> | ||
<complexContent> | ||
<extension base="msgs:Record"> | ||
<sequence> | ||
<element name="name" type="string"/> | ||
</sequence> | ||
</extension> | ||
</complexContent> | ||
</complexType> | ||
|
||
<element name="addList" type="msgs:AddListRequest"/> | ||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns:tns="urn:urn:example:ws" | ||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | ||
xmlns="http://schemas.xmlsoap.org/wsdl/" | ||
xmlns:msgs="urn:example" | ||
targetNamespace="urn:urn:example:ws"> | ||
<types> | ||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> | ||
<xsd:import namespace="urn:example" schemaLocation="soap.messages.xsd"/> | ||
</xsd:schema> | ||
</types> | ||
<message name="addListRequest"> | ||
<part name="parameters" element="msgs:addList"/> | ||
</message> | ||
<message name="addListResponse"> | ||
<part name="parameters" element="msgs:addListResponse"/> | ||
</message> | ||
<portType name="NetSuitePortType"> | ||
<operation name="addList"> | ||
<input name="addListRequest" message="tns:addListRequest"/> | ||
<output name="addListResponse" message="tns:addListResponse"/> | ||
</operation> | ||
</portType> | ||
<binding name="NetSuiteBinding" type="tns:NetSuitePortType"> | ||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<operation name="addList"> | ||
<soap:operation soapAction="addList"/> | ||
<input name="addListRequest"> | ||
<soap:body use="literal"/> | ||
</input> | ||
<output name="addListResponse"> | ||
<soap:body use="literal"/> | ||
</output> | ||
</operation> | ||
</binding> | ||
<service name="NetSuiteService"> | ||
<port name="NetSuitePort" binding="tns:NetSuiteBinding"> | ||
<soap:address location="http://localhost:1509"/> | ||
</port> | ||
</service> | ||
</definitions> |