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

Adding custom envelope key option for server #1208

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
convert new tests to use Axios
w666 committed Aug 20, 2024
commit a2ec9f0a0189c4e95aa5b6b6934be2f26ec8afe1
62 changes: 30 additions & 32 deletions test/server-options-test.js
Original file line number Diff line number Diff line change
@@ -625,8 +625,8 @@ describe('SOAP Server with Options', function () {
});
});

it('should return soapenv as envelope key when it is set to soapenv', function(done) {
test.server.listen(15099, null, null, function() {
it('should return soapenv as envelope key when it is set to soapenv', function (done) {
test.server.listen(15099, null, null, function () {
test.soapServer = soap.listen(test.server, {
path: '/stockquote',
services: test.service,
@@ -642,32 +642,31 @@ describe('SOAP Server with Options', function () {
test.baseUrl = 'http://127.0.0.1:' + test.server.address().port;
}
// console.log(test.baseUrl);
request.post({
url: test.baseUrl + '/stockquote',
body: '<soapenv:Envelope' +
' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' +
' xmlns:soap="http://service.applicationsnet.com/soap/">' +
' <soapenv:Header/>' +
' <soapenv:Body>' +
'</soapenv:Envelope>'
}, function(err, res, body) {
assert.ifError(err);
assert.ok(
body.indexOf('soapenv:Envelope') > -1
)
axios.post(
test.baseUrl + '/stockquote',
'<soapenv:Envelope' +
' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' +
' xmlns:soap="http://service.applicationsnet.com/soap/">' +
' <soapenv:Header/>' +
' <soapenv:Body>' +
'</soapenv:Envelope>'
).then(res => {
assert.ok(res.data.indexOf('soapenv:Envelope') > -1);
done();
}).catch(err => {
throw err;
});
});
});

it('should return soap as envelope key by default', function(done) {
test.server.listen(15099, null, null, function() {
it('should return soap as envelope key by default', function (done) {
test.server.listen(15099, null, null, function () {
test.soapServer = soap.listen(test.server, {
path: '/stockquote',
services: test.service,
xml: test.wsdl,
uri: __dirname + '/wsdl/strict/',
forceSoap12Headers : true
forceSoap12Headers: true
}, test.service, test.wsdl);
test.baseUrl = 'http://' + test.server.address().address + ":" + test.server.address().port;

@@ -677,22 +676,21 @@ describe('SOAP Server with Options', function () {
test.baseUrl = 'http://127.0.0.1:' + test.server.address().port;
}
// console.log(test.baseUrl);
request.post({
url: test.baseUrl + '/stockquote',
body: '<soapenv:Envelope' +
' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' +
' xmlns:soap="http://service.applicationsnet.com/soap/">' +
' <soapenv:Header/>' +
' <soapenv:Body>' +
'</soapenv:Envelope>'
}, function(err, res, body) {
assert.ifError(err);
assert.ok(
body.indexOf('soap:Envelope') > -1
)
axios.post(
test.baseUrl + '/stockquote',
'<soapenv:Envelope' +
' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' +
' xmlns:soap="http://service.applicationsnet.com/soap/">' +
' <soapenv:Header/>' +
' <soapenv:Body>' +
'</soapenv:Envelope>'
).then(res => {
assert.ok(res.data.indexOf('soap:Envelope') > -1);
done();
}).catch(err => {
throw err;
});
});
});

});