forked from vpulim/node-soap
/
post-data-concat-test.js
52 lines (43 loc) · 1.38 KB
/
post-data-concat-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
var fs = require('fs');
var soap = require('..');
var assert = require('assert');
var http = require('http');
describe('post data concat test', function () {
it('should consider the situation about multi-byte character between two tcp packets', function (done) {
var check = function (a, b) {
if (a && b) {
assert(a === b);
done();
}
};
var wsdl = 'test/wsdl/default_namespace.wsdl';
var server = http.createServer(function (req, res) { });
var xml = fs.readFileSync(wsdl, 'utf8');
var service = {
MyService: {
MyServicePort: {
MyOperation: function (arg) {
console.log(arg);
check(arg, postdata);
return "0";
}
}
}
};
server.listen(51515);
soap.listen(server, '/wsdl', service, xml);
var postdata = "";
for (var i = 0; i < 20000; i++) {
postdata += "测试";
}
soap.createClient(wsdl, {
endpoint: 'http://localhost:51515/wsdl'
}, function (error, client) {
assert(!error);
client.MyOperation(postdata, function (error, response) {
server.close();
});
});
});
});