1
//===================================================================================
3
// (C) COPYRIGHT International Business Machines Corp., 2002 All Rights Reserved
4
// Licensed Materials - Property of IBM
5
// US Government Users Restricted Rights - Use, duplication or
6
// disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
8
// IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
9
// ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
10
// PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
11
// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
12
// USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
14
// OR PERFORMANCE OF THIS SOFTWARE.
16
// The program may be used, executed, copied, modified, and distributed
17
// without royalty for the purpose of developing, using, marketing, or distributing.
19
//=======================================================================================
20
// gSOAP v2 Interop test round 2 base
21
//#include "interoptA.h"
24
extern "C" void displayText(char *text);
25
extern "C" int interopA(const char *url);
27
struct Namespace namespacesA[] =
28
{ {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"},
29
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"},
30
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance"},
31
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema"},
32
{"ns", "http://soapinterop.org/"},
33
{"s", "http://soapinterop.org/xsd"},
34
{"a", "http://xml.apache.org/xml-soap"},
35
{"h", "http://soapinterop.org/echoheader/"},
39
int interopA(const char *url)
43
xsd__string so, si = "Hello World! <>&";
44
struct ArrayOfstring Asi, Aso;
45
xsd__int no, ni = 1234567890;
46
xsd__int n = 2147483647;
47
struct ArrayOfint Ani, Ano;
48
// xsd__float f1 = 3.40282e+38;
49
xsd__float f1 = 123.5678;
51
xsd__float fo, fi = 123.456;
52
// xsd__float fo, fi = 3e2;
54
// const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan;
56
xsd__float nan = FLT_NAN, inf = FLT_PINFTY, ninf = FLT_NINFTY;
57
struct ArrayOffloat Afi, Afo;
58
struct s__SOAPStruct sti, *p;
59
struct ns__echoStructResponse sto;
60
struct ArrayOfSOAPStruct Asti, Asto;
61
struct ns__echoVoidResponse Rv;
62
struct xsd__base64Binary b64i, b64o;
63
xsd__dateTime dto, dti = "1967-12-29T01:02:03";
64
struct xsd__hexBinary hbi, hbo;
65
xsd__decimal Do, Di = "1234567890.123456789";
66
xsd__boolean bo, bi = true;
67
//struct a__Map mi, mo;
68
//struct ArrayOfMap Ami, Amo;
70
displayText("running test A on");
71
displayText((char*)url);
73
soap->namespaces = (struct Namespace *)namespacesA;
75
// soap.send_timeout = 30;
76
// soap.recv_timeout = 30;
81
Asi.__ptr = (xsd__string*)malloc(Asi.__size*sizeof(xsd__string));
83
Asi.__ptr[1] = " Hello\tWorld";
93
Ani.__ptr = NULL; // (xsd__int*)malloc(Ani.__size*sizeof(xsd__int));
97
Afi.__ptr = (xsd__float**)malloc(Afi.__size*sizeof(xsd__float*));
99
Afi.__ptr[1] = &nan; // FLT_NAN;
100
Afi.__ptr[2] = &inf; // FLT_PINFTY;
101
Afi.__ptr[3] = &ninf; // FLT_NINFTY;
104
sti.varString = "Hello";
110
Asti.__ptr = (struct s__SOAPStruct**)malloc((Asti.__size+1)*sizeof(struct s__SOAPStruct*));
111
p = (struct s__SOAPStruct*)malloc(Asti.__size*sizeof(struct s__SOAPStruct));
116
Asti.__ptr[0]->varString = "Hello";
117
Asti.__ptr[0]->varInt = &n;
118
Asti.__ptr[0]->varFloat = &f1;
119
Asti.__ptr[1]->varString = "World";
120
Asti.__ptr[1]->varInt = &n;
121
Asti.__ptr[1]->varFloat = &f2;
122
Asti.__ptr[2]->varString = "!";
123
Asti.__ptr[2]->varInt = &n;
124
Asti.__ptr[2]->varFloat = &f2;
126
// b64i.__ptr = (unsigned char*)"This is an example Base64 encoded string";
127
// b64i.__size = strlen((char*)b64i.__ptr)+1;
128
unsigned char b64data[4]={0x80, 0x81, 0x82, 0x83};
129
b64i.__ptr = b64data;
132
hbi.__ptr = (unsigned char*)"This is an example HexBinary encoded string";
133
hbi.__size = strlen((char*)hbi.__ptr)+1;
136
mi.__ptr = (struct _item*)malloc(mi.__size*sizeof(struct _item));
137
mi.__ptr[0].key = new xsd__string_("hello");
138
mi.__ptr[0].value = new xsd__string_("world");
139
mi.__ptr[1].key = new xsd__int_(2);
140
mi.__ptr[1].value = new xsd__boolean_(true);
143
Ami.__ptr = (struct a__Map**)malloc(Ami.__size*sizeof(struct a__Map*));
145
Ami.__ptr[1] = &mi; */
146
char *site=(char*)url;
147
// char* site ="http://websrv.cs.fsu.edu/~engelen/interop2.cgi";
148
// char* site = "http://nagoya.apache.org:5049/axis/services/echo ";
149
char* action = "http://soapinterop.org/";
153
if (soap_call_ns__echoString(soap, site, action, si, so))
155
displayText("echoString fail");
158
else if (!so || strcmp(si, so))
161
displayText("echoString mismatched");
164
displayText("echoString pass");
167
if (soap_call_ns__echoInteger(soap, site, "http://soapinterop.org/", ni, no))
170
displayText("echoInteger fail");
175
displayText("echoInteger mismatched");
178
displayText("echoInteger pass");
180
if (soap_call_ns__echoFloat(soap, site, "http://soapinterop.org/", fi, fo))
183
displayText("echoFloat fail");
188
displayText("echoFloat mismatched");
191
displayText("echoFloat pass");
193
if (soap_call_ns__echoStruct(soap, site, "http://soapinterop.org/", sti, sto))
196
displayText("echoStruct fail");
198
else if (!sto._return.varString || strcmp(sti.varString, sto._return.varString)
199
|| !sto._return.varInt || *sti.varInt != *sto._return.varInt
200
|| !sto._return.varFloat || *sti.varFloat != *sto._return.varFloat)
203
displayText("echoStruct mismatch");
206
displayText("echoStruct pass");
208
if (soap_call_ns__echoStringArray(soap, site, "http://soapinterop.org/", Asi, Aso))
210
soap_set_fault(soap);
211
soap_faultdetail(soap);
213
displayText("echoStringArray fail");
217
if (Asi.__size != Aso.__size)
220
for (i = 0; i < Asi.__size; i++)
221
if (Asi.__ptr[i] && Aso.__ptr[i] && strcmp(Asi.__ptr[i], Aso.__ptr[i]))
223
else if (!Asi.__ptr[i])
225
else if (Asi.__ptr[i] && !Aso.__ptr[i])
230
displayText("echoStringArray mismatch");
233
displayText("echoStringArray pass");
236
if (soap_call_ns__echoIntegerArray(soap, site, "http://soapinterop.org/", Ani, Ano))
237
{ displayText("echoIntegerArray fail");
242
if (Ani.__size != Ano.__size)
245
for (i = 0; i < Ani.__size; i++)
246
if (Ani.__ptr[i] && (!Ano.__ptr[i] || *Ani.__ptr[i] != *Ano.__ptr[i]))
249
{ displayText("echoIntegerArray mismatch");
253
displayText("echoIntegerArray pass");
256
if (soap_call_ns__echoFloatArray(soap, site, "http://soapinterop.org/", Afi, Afo))
257
{ displayText("echoFloatArray fail");
262
if (Afi.__size != Afo.__size)
265
for (i = 0; i < Afi.__size; i++)
266
if (Afi.__ptr[i] && Afo.__ptr[i] && soap_isnan(*Afi.__ptr[i]) && soap_isnan(*Afo.__ptr[i]))
268
else if (Afi.__ptr[i] && (!Afo.__ptr[i] || *Afi.__ptr[i] != *Afo.__ptr[i]))
271
{ displayText("echoFloatArray mismatch");
275
displayText("echoFloatArray pass");
278
if (soap_call_ns__echoStructArray(soap, site, "http://soapinterop.org/", Asti, Asto))
279
{ displayText("echoStructArray fail");
284
if (Asti.__size+Asti.__offset != Asto.__size+Asto.__offset)
287
for (i = Asti.__offset; i < Asti.__size+Asti.__offset; i++)
288
if (!Asto.__ptr[i-Asto.__offset] ||
289
!Asto.__ptr[i-Asto.__offset]->varString ||
290
strcmp(Asti.__ptr[i-Asti.__offset]->varString, Asto.__ptr[i-Asto.__offset]->varString) ||
291
!Asto.__ptr[i-Asto.__offset]->varInt ||
292
*Asti.__ptr[i-Asti.__offset]->varInt != *Asto.__ptr[i-Asto.__offset]->varInt ||
293
!Asto.__ptr[i-Asto.__offset]->varFloat ||
294
*Asti.__ptr[i-Asti.__offset]->varFloat != *Asto.__ptr[i-Asto.__offset]->varFloat)
297
{ displayText("echoStructArray mismatch");
301
displayText("echoStructArray pass");
304
if (soap_call_ns__echoVoid(soap, site, "http://soapinterop.org/", Rv))
305
{ displayText("echoVoid fail");
309
displayText("echoVoid pass");
312
if (soap_call_ns__echoBase64(soap, site, "http://soapinterop.org/", b64i, b64o))
313
{ displayText("echoBase64 fail");
316
else if ((b64i.__size+2)/3 != (b64o.__size+2)/3 || strncmp((char*)b64i.__ptr, (char*)b64o.__ptr,b64i.__size))
318
displayText("echoBase64 mismatch");
322
displayText("echoBase64 pass");
324
if (soap_call_ns__echoDate(soap, site, "http://soapinterop.org/", dti, dto))
326
displayText("echoDate fail");
329
else if (!dto || strncmp(dti, dto, 19))
331
displayText("echoDate mismatch");
335
displayText("echoDate pass");
338
if (soap_call_ns__echoHexBinary(soap, site, "http://soapinterop.org/", hbi, hbo))
341
displayText("echoHexBinary fail");
343
else if (hbi.__size != hbo.__size || strcmp((char*)hbi.__ptr, (char*)hbo.__ptr))
346
displayText("echoHexBinary mismatch");
349
displayText("echoHexBinary pass");
352
if (soap_call_ns__echoDecimal(soap, site, "http://soapinterop.org/", Di, Do))
355
displayText("echoDecimal pass");
357
else if (strcmp(Di, Do))
360
displayText("echoDecimal mismatch");
363
displayText("echoDecimal pass");
366
if (soap_call_ns__echoBoolean(soap, site, "http://soapinterop.org/", bi, bo))
369
displayText("echoBoolean fail");
374
displayText("echoBoolean mismatch");
377
displayText("echoBoolean pass");
380
displayText("ALL PASS");
382
displayText("FAILURES");