-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* check method style if exists instead of binding style (#1153)
* * check method style if exists instead of binding style * * replace pair.methodName by methodName * reduce code duplication * * accidental merge old code * * respect code style
- Loading branch information
Showing
4 changed files
with
156 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var request = require('request'); | ||
var assert = require('assert'); | ||
var http = require('http'); | ||
var soap = require('..'); | ||
var server; | ||
var url; | ||
|
||
var path = 'test/wsdl/wsdl_style_mix.wsdl'; | ||
var wsdl = fs.readFileSync(path, 'utf8');; | ||
|
||
/** | ||
* requested operation has 'document' style while the binding itself has 'rpc' style | ||
**/ | ||
var requestXML = ` | ||
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:hl7-org:v3"> | ||
<soapenv:Header/> | ||
<soapenv:Body> | ||
<urn:hl7Message> | ||
<test></test> | ||
</urn:hl7Message> | ||
</soapenv:Body> | ||
</soapenv:Envelope>`; | ||
|
||
var responseXMLGood = `<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://tempuri.org/" xmlns:urn="urn:hl7-org:v3"><soap:Body><urn:hl7Message xmlns:urn="urn:hl7-org:v3" xmlns="urn:hl7-org:v3"><urn:result></urn:result></urn:hl7Message></soap:Body></soap:Envelope>`; | ||
|
||
var service = { | ||
HL7Service: { | ||
Hl7MessageBinding: { | ||
opHl7Message: function (args, callback) { | ||
callback({ result: {} }); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
describe('server has mixed style', function () { | ||
|
||
before(function (done) { | ||
|
||
server = http.createServer(function (request, response) { | ||
response.end('404: Not Found: ' + request.url); | ||
}); | ||
|
||
server.listen(51515, function () { | ||
soap.listen(server, '/', service, wsdl); | ||
|
||
url = 'http://' + server.address().address + ':' + server.address().port; | ||
if (server.address().address === '0.0.0.0' || server.address().address === '::') { | ||
url = 'http://127.0.0.1:' + server.address().port; | ||
} | ||
done(); | ||
}); | ||
}); | ||
|
||
after(function () { | ||
server.close(); | ||
}); | ||
|
||
it('should return good response', function (done) { | ||
request({ | ||
url: url, | ||
method: 'POST', | ||
headers: { | ||
SOAPAction: "urn:#opHl7Message", | ||
"Content-Type": 'text/xml; charset="utf-8"' | ||
}, | ||
body: requestXML | ||
}, function (err, response, body) { | ||
if (err) { | ||
throw err; | ||
} | ||
assert.strictEqual(body, responseXMLGood); | ||
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,54 @@ | ||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns:tns="http://tempuri.org/" | ||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | ||
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" | ||
xmlns:urn="urn:hl7-org:v3" name="HL7Service" | ||
targetNamespace="http://tempuri.org/"> | ||
|
||
<wsdl:types> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:tns="urn:hl7-org:v3" elementFormDefault="qualified" targetNamespace="urn:hl7-org:v3"> | ||
<xs:element name="hl7Message"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:any/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:schema> | ||
</wsdl:types> | ||
|
||
<wsdl:message name="opHl7MessageRequest"> | ||
<wsdl:part name="hl7Message" element="urn:hl7Message"/> | ||
</wsdl:message> | ||
<wsdl:message name="opHl7MessageResponse"> | ||
<wsdl:part name="hl7Message" element="urn:hl7Message"/> | ||
</wsdl:message> | ||
|
||
<wsdl:portType name="portHl7Message"> | ||
<wsdl:operation name="opHl7Message"> | ||
<wsdl:input wsaw:Action="urn:#opHl7Message" name="opHl7MessageRequest" message="tns:opHl7MessageRequest"/> | ||
<wsdl:output wsaw:Action="urn:#opHl7MessageResponse" name="opHl7MessageResponse" message="tns:opHl7MessageResponse"/> | ||
</wsdl:operation> | ||
</wsdl:portType> | ||
|
||
<wsdl:binding name="Hl7MessageBinding" type="tns:portHl7Message"> | ||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/> | ||
<wsdl:operation name="opHl7Message"> | ||
<soap:operation soapAction="urn:#opHl7Message" style="document"/> | ||
<wsdl:input name="opHl7MessageRequest"> | ||
<soap:body use="literal"/> | ||
</wsdl:input> | ||
<wsdl:output name="opHl7MessageResponse"> | ||
<soap:body use="literal"/> | ||
</wsdl:output> | ||
</wsdl:operation> | ||
</wsdl:binding> | ||
|
||
<wsdl:service name="HL7Service"> | ||
<wsdl:port name="Hl7MessageBinding" binding="tns:Hl7MessageBinding"> | ||
<soap:address location="http://127.0.0.1"/> | ||
</wsdl:port> | ||
</wsdl:service> | ||
</wsdl:definitions> |