Skip to content

Commit

Permalink
test for extension base attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Willem Weber committed Jan 6, 2021
1 parent 79b899c commit 0d2916f
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/wsdl-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ describe('WSDL Parser (strict)', () => {
});
});
});

it('should handle extension base', (done) => {
var expectedMsg = '<bar:Shipper xmlns:bar="http://example.com/bar/xsd"' +
' xmlns="http://example.com/bar/xsd"><bar:Name>' +
'<bar1:name1 xmlns:bar1="http://example.com/bar1/xsd">ABC</bar1:name1></bar:Name>' +
'</bar:Shipper>';
soap.createClient(__dirname + '/wsdl/extensionBase/foo.wsdl', {strict: true}, function(err, client) {
assert.ifError(err);
client.fooOp({Name: {name1: 'ABC'}}, function(err, result) {
assert.equal(client.lastMessage, expectedMsg);
done();
});
});
});

it('should parse POJO into xml without making unnecessary recursion', (done) => {
var expectedMsg = require('./wsdl/perf/request.xml.js');
Expand Down
19 changes: 19 additions & 0 deletions test/wsdl/extensionBase/bar.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<xsd:schema targetNamespace="http://example.com/bar/xsd"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bar1="http://example.com/bar1/xsd"
xmlns:bar="http://example.com/bar/xsd">
<xsd:import namespace="http://example.com/bar1/xsd"
schemaLocation="bar1.xsd"/>
<xsd:element name="Shipper" type="bar:ShipperType"/>
<xsd:complexType name="ShipperTypeType">
<xsd:sequence>
<xsd:element name="Name" type="bar1:NameType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ShipperType">
<xsd:complexContent>
<xsd:extension base="bar:ShipperTypeType" />
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
17 changes: 17 additions & 0 deletions test/wsdl/extensionBase/bar1.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<xsd:schema targetNamespace="http://example.com/bar1/xsd"
elementFormDefault="qualified" version="2.1.4"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bar1="http://example.com/bar1/xsd">
<xsd:complexType name="NameType">
<xsd:sequence>
<xsd:element ref="bar1:name1" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="name1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
53 changes: 53 additions & 0 deletions test/wsdl/extensionBase/foo.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="foo"
targetNamespace="http://example.com/foo/wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:bar="http://example.com/bar/xsd"
xmlns:tns="http://example.com/foo/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema>
<xsd:import
namespace="http://example.com/bar/xsd"
schemaLocation="bar.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="fooRs">
<wsdl:part name="fooRs" element="bar:Shipper">
</wsdl:part>
</wsdl:message>
<wsdl:message name="fooRq">
<wsdl:part name="fooRq" element="bar:Shipper">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="foo_PortType">
<wsdl:operation name="fooOp">
<wsdl:input message="tns:fooRq">
</wsdl:input>
<wsdl:output message="tns:fooRs">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="foo_Binding" type="tns:foo_PortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="fooOp">
<soap:operation soapAction="fooPayment"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="foo">
<wsdl:port name="payment_Port"
binding="tns:foo_Binding">
<soap:address
location="http://localhost:8888/mockfoo_Binding"/>
</wsdl:port>
</wsdl:service>
<xsd:attriute fixed="2.1.4" name="version"/>
</wsdl:definitions>

0 comments on commit 0d2916f

Please sign in to comment.