forked from vpulim/node-soap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fields sequence if it's required (need help) (vpulim#914)
- Loading branch information
Showing
5 changed files
with
183 additions
and
2 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
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,55 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'), | ||
soap = require('..'), | ||
http = require('http'), | ||
assert = require('assert'), | ||
_ = require('lodash'), | ||
sinon = require('sinon'), | ||
wsdl = require('../lib/wsdl'); | ||
|
||
var sequencedRequest = { | ||
'url': 'https://github.com', | ||
'fileName': 'qwe.txt', | ||
'fileMode': 1, | ||
'forceOverwrite': true, | ||
'username': 'qwert', | ||
'password': 'qwerty', | ||
'base64EncodedCallback': '123' | ||
}; | ||
|
||
var notSequencedRequest = { | ||
'password': 'qwerty', | ||
'base64EncodedCallback': '123', | ||
'username': 'qwert', | ||
'forceOverwrite': true, | ||
'fileMode': 1, | ||
'fileName': 'qwe.txt', | ||
'url': 'https://github.com' | ||
}; | ||
|
||
describe('Method args sequence', function() { | ||
|
||
it('check if method required sequence args', function(done) { | ||
soap.createClient(__dirname + '/wsdl/rpcexample.wsdl', { suffix: '', options: {} }, function(err, client) { | ||
assert.ok(client); | ||
assert.ok(client._isSequenceRequired('pullFile') === false); | ||
|
||
soap.createClient(__dirname + '/wsdl/sequnceexmple.wsdl', { suffix: '', options: {} }, function(err, client) { | ||
assert.ok(client); | ||
assert.ok(client._isSequenceRequired('pullFile') === true); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
it('check sort args on sequence required method', function(done) { | ||
soap.createClient(__dirname + '/wsdl/sequnceexmple.wsdl', { suffix: '', options: {} }, function(err, client) { | ||
assert.ok(client); | ||
var sequencedMethodRequest = client._setSequenceArgs(client._getArgsScheme('pullFile'), notSequencedRequest); | ||
assert.ok(JSON.stringify(sequencedMethodRequest) === JSON.stringify(sequencedRequest)); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
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,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns:tns="urn:RpcExample" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" | ||
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns:RpcExample="urn:RpcExample" xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap12/" | ||
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/" | ||
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/" xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/" | ||
xmlns="http://schemas.xmlsoap.org/wsdl/" name="urn:RpcExample" targetNamespace="urn:RpcExample"> | ||
<types> | ||
<schema xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" | ||
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns:RpcExample="urn:RpcExample" xmlns="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="urn:RpcExample" elementFormDefault="unqualified" attributeFormDefault="unqualified"> | ||
<import namespace="http://www.w3.org/2003/05/soap-encoding"/> | ||
<element name="pullFile"> | ||
<complexType> | ||
<sequence> | ||
<element name="url" type="xsd:string" minOccurs="1" maxOccurs="1"/> | ||
<element name="fileName" type="xsd:string" minOccurs="1" maxOccurs="1"/> | ||
<element name="fileMode" type="xsd:int" minOccurs="1" maxOccurs="1"/> | ||
<element name="forceOverwrite" type="xsd:boolean" minOccurs="1" maxOccurs="1"/> | ||
<element name="username" type="xsd:string" minOccurs="1" maxOccurs="1"/> | ||
<element name="password" type="xsd:string" minOccurs="1" maxOccurs="1"/> | ||
<element name="base64EncodedCallback" type="xsd:string" minOccurs="1" maxOccurs="1"/> | ||
</sequence> | ||
</complexType> | ||
</element> | ||
</schema> | ||
</types> | ||
<message name="pullFileRequest"> | ||
<part name="parameters" element="tns:pullFile"/> | ||
</message> | ||
<message name="pullFileResponse"> | ||
<part name="parameters" type="xsd:boolean"/> | ||
</message> | ||
<portType name="RpcExamplePortType"> | ||
<operation name="pullFile"> | ||
<documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Generate an indicium.</documentation> | ||
<input message="tns:pullFileRequest"/> | ||
<output message="tns:pullFileResponse"/> | ||
</operation> | ||
</portType> | ||
<binding name="RpcExample" type="tns:RpcExamplePortType"> | ||
<SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<operation name="pullFile"> | ||
<SOAP:operation style="rpc"/> | ||
<input> | ||
<SOAP:body use="encoded" namespace="urn:RpcExample" | ||
encodingStyle="http://www.w3.org/2003/05/soap-encoding"/> | ||
</input> | ||
<output> | ||
<SOAP:body use="encoded" namespace="urn:RpcExample" | ||
encodingStyle="http://www.w3.org/2003/05/soap-encoding"/> | ||
</output> | ||
</operation> | ||
</binding> | ||
<service name="RpcExample"> | ||
<port name="RpcExample" binding="tns:RpcExample"> | ||
<SOAP:address location="http://127.0.0.1/"/> | ||
</port> | ||
</service> | ||
</definitions> |