forked from vpulim/node-soap
/
post-data-concat-test.js
59 lines (47 loc) · 1.43 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
52
53
54
55
56
57
58
'use strict';
var fs = require('fs');
var soap = require('..');
var assert = require('assert');
var http = require('http');
describe('post data concat test', function () {
var server = http.createServer(function (req, res) { });
before(function () {
server.listen(51515);
});
after(function () {
server.close();
});
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 xml = fs.readFileSync(wsdl, 'utf8');
var service = {
MyService: {
MyServicePort: {
MyOperation: function (arg) {
check(arg, postdata);
return "0";
}
}
}
};
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) {
assert(!error);
});
});
});
});