Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get current namespace when parent namespace is empty string #661

Merged
merged 1 commit into from
May 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/wsdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ WSDL.prototype.objectToXML = function(obj, name, namespace, xmlns, first, xmlnsA
var schema = this.definitions.schemas[xmlns];

var parentNamespace = namespace ? namespace.parent : undefined;
if(parentNamespace) {
if(typeof parentNamespace !== 'undefined') {
//we got the parentNamespace for our array. setting the namespace-variable back to the current namespace string
namespace = namespace.current;
}
Expand Down
13 changes: 13 additions & 0 deletions test/wsdl-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ wsdlStrictTests['should parse external wsdl'] = function(done) {
});
};

wsdlStrictTests['should get the parent namespace when parent namespace is empty string'] = function(done) {
soap.createClient(__dirname+'/wsdl/marketo.wsdl', {strict: true}, function(err, client){
assert.ok(!err);
client.getLeadChanges({
batchSize: 1,
startPosition: {activityCreatedAt: '2014-04-14T22:03:48.587Z'},
activityNameFilter: {stringItem: ['Send Email']}
}, function() {
done();
});
});
};

module.exports = {
'WSDL Parser (strict)': wsdlStrictTests,
'WSDL Parser (non-strict)': wsdlNonStrictTests
Expand Down
65 changes: 65 additions & 0 deletions test/wsdl/marketo.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Marketo API Version 2_6 -->
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.marketo.com/mktows/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" name="mktows" targetNamespace="http://www.marketo.com/mktows/">
<wsdl:types>
<xs:schema targetNamespace="http://www.marketo.com/mktows/">
<xs:complexType name="ArrayOfString">
<xs:sequence>
<xs:element name="stringItem" type="xs:string" minOccurs="0" maxOccurs="unbounded" nillable="false"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="ParamsGetLeadChanges">
<xs:sequence>
<xs:element name="startPosition" type="tns:StreamPosition" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element name="activityFilter" type="tns:ActivityTypeFilter" minOccurs="0" maxOccurs="1" nillable="true"/>
<xs:element name="activityNameFilter" type="tns:ArrayOfString" minOccurs="0" maxOccurs="1" nillable="true"/>
<xs:element name="batchSize" type="xs:int" minOccurs="0" maxOccurs="1" nillable="true"/>
<xs:element name="leadSelector" type="tns:LeadSelector" minOccurs="0" maxOccurs="1" nillable="false"/>
</xs:sequence>
</xs:complexType>

<xs:element name="paramsGetLeadChanges" type="tns:ParamsGetLeadChanges"/>
<xs:element name="successGetLeadChanges" type="tns:SuccessGetLeadChanges"/>
</xs:schema>
</wsdl:types>

<wsdl:message name="GetLeadChangesRequest">
<wsdl:part name="paramsGetLeadChanges" element="tns:paramsGetLeadChanges"/>
</wsdl:message>
<wsdl:message name="GetLeadChangesResponse">
<wsdl:part name="successGetLeadChanges" element="tns:successGetLeadChanges"/>
</wsdl:message>

<wsdl:portType name="MktowsPort">
<wsdl:operation name="getLeadChanges">
<wsdl:documentation>Get changes for all leads.
</wsdl:documentation>
<wsdl:input message="tns:GetLeadChangesRequest"/>
<wsdl:output message="tns:GetLeadChangesResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="MktowsApiSoapBinding" type="tns:MktowsPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getLeadChanges">
<soap:operation soapAction="http://www.marketo.com/mktows/getLeadChanges" />
<wsdl:input>
<soap:header use="literal" part="authentication" message="tns:AuthenticationHeader" />
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="MktMktowsApiService">
<wsdl:port name="MktowsApiSoapPort" binding="tns:MktowsApiSoapBinding">
<soap:address location="https://000-hwq-023.mktoapi.com/soap/mktows/2_6" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>