You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pe...@apache.org on 2005/03/07 15:11:24 UTC
cvs commit: ws-axis/c/tests/auto_build/testcases/wsdls ComplexLists.wsdl
perryan 2005/03/07 06:11:24
Added: c/tests/auto_build/testcases/client/cpp
ComplexListsClient.cpp
c/tests/auto_build/testcases/output ComplexLists.expected
c/tests/auto_build/testcases/tests ComplexLists.xml
c/tests/auto_build/testcases/wsdls ComplexLists.wsdl
Log:
New test for complex issues with namespaces and arrays within complex elements
Revision Changes Path
1.1 ws-axis/c/tests/auto_build/testcases/client/cpp/ComplexListsClient.cpp
Index: ComplexListsClient.cpp
===================================================================
/*
* ComplexLists tests several things all at once.
*
* The areas being tested are:
* 1. AXISCPP-487 - Elements of basic XSD types do not serialize namespace declaration
* 2. AXISCPP-488 - Array types don't serialize namespace declarations
* 3. AXISCPP-489 - Serializer not removing namespaces as they go out of scope
*
*/
#include "ComplexLists.hpp"
#include <axis/AxisException.hpp>
#include <iostream>
#define ARRAYSIZE 2
int main(int argc, char* argv[])
{
char endpoint[256];
const char* url="http://localhost:80/axis/ComplexLists";
if(argc>1) url = argv[1];
try
{
sprintf(endpoint, "%s", url);
ComplexLists* ws = new ComplexLists(endpoint);
m_list ml; // xsd__string array
m_list mlnp; // used for 1st namepair item of array
m_list mlnp2; // used for 2nd namepair item of array
attrlist al; // attrlist has namepair array
namepair np1; // namepair has m_list and name
namepair np2;
namepair_Array npArr;
// m_list arg to numtilist
ml.item.m_Array = new char*[ARRAYSIZE]; // make storage for array
ml.item.m_Size = ARRAYSIZE; // tell it how big it is
ml.item.m_Array[0] = "never odd or even"; // should be returned in errortext element of attrlisterr
ml.item.m_Array[1] = "any data string"; // add data
// To set into namepair item of namepair array of attrlist arg of multilist
mlnp.item.m_Array = new char*[ARRAYSIZE];
mlnp.item.m_Size = ARRAYSIZE;
mlnp.item.m_Array[0] = "Apache";
mlnp.item.m_Array[1] = "Axis C++";
// To set into namepair item of namepair array of attrlist arg of multilist
mlnp2.item.m_Array = new char*[ARRAYSIZE];
mlnp2.item.m_Size = ARRAYSIZE;
mlnp2.item.m_Array[0] = "Test";
mlnp2.item.m_Array[1] = "Complex";
// set first namepair item to put into array
np1.m_list_Ref = &mlnp;
np1.name = "namepair1";
// set second namepair item to put into array
np2.m_list_Ref = &mlnp2;
np2.name = "namepair2";
// create a namepair array to add into attrlist
npArr.m_Size=ARRAYSIZE;
npArr.m_Array = new namepair*[ARRAYSIZE];
npArr.m_Array[0]=&np1;
npArr.m_Array[1]=&np2;
// set attrlist argument
al.item = npArr;
attrlisterr* ale = ws->multilist(&ml, &al);
if(ale) {
// Should have an errortext string, an errorcode int and a m_list object returned
cout << ale->errortext << endl; // should be 'request successful'
cout << ale->errorcode << endl; // should be 7
cout << ale->attrlist_Ref->item.m_Array[0]->name << endl; // 'namepair return'
cout << ale->attrlist_Ref->item.m_Array[0]->m_list_Ref->item.m_Array[0] << endl; // 'never odd or even'
} else {
cout << "Deserialized response is NULL" << endl;
}
ale = ws->multilist((m_list*)NULL, &al);
if(ale) {
// Should have an errortext string, an errorcode int and a m_list object returned
cout << ale->errortext << endl; // 'request successful'
cout << ale->errorcode << endl; // 007
cout << ale->attrlist_Ref->item.m_Array[0]->name << endl; // 'namepair return'
cout << ale->attrlist_Ref->item.m_Array[0]->m_list_Ref->item.m_Array[0] << endl; // 'attrlist->m_list-item[0] was NULL'
} else {
cout << "Deserialized response is NULL" << endl;
}
// Have nil elements in response
ale = ws->multilistnil((m_list*)NULL, &al);
if(ale) {
// Should have an errortext string, an errorcode int and a m_list object returned
cout << ale->errortext << endl; // empty
cout << ale->errorcode << endl; // 0
cout << ale->attrlist_Ref->item.m_Array[0]->name << endl; // empty
cout << ale->attrlist_Ref->item.m_Array[0]->m_list_Ref->item.m_Array[0] << endl; // empty
} else {
cout << "Deserialized response is NULL" << endl;
}
ale = ws->complexlist(&al, "hoohah!", &al);
if(ale) {
// Should have an errortext string, an errorcode int and a m_list object returned
cout << ale->errortext << endl;
cout << ale->errorcode << endl;
cout << ale->attrlist_Ref->item.m_Array[0]->name << endl;
cout << ale->attrlist_Ref->item.m_Array[0]->m_list_Ref->item.m_Array[0] << endl;
} else {
cout << "Deserialized response is NULL" << endl;
}
delete ws;
}
catch(AxisException& e)
{
cout << "Exception : " << e.what() << endl;
}
catch(exception& e)
{
cout << "Unknown exception has occured" << endl;
}
catch(...)
{
cout << "Unknown exception has occured" << endl;
}
cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
return 0;
}
1.1 ws-axis/c/tests/auto_build/testcases/output/ComplexLists.expected
Index: ComplexLists.expected
===================================================================
request successful
7
namepair return
never odd or even
request successful
7
namepair return
attrlist->m_list-item[0] was NULL
0
request successful
7
namepair return
Apache
---------------------- TEST COMPLETE -----------------------------
1.1 ws-axis/c/tests/auto_build/testcases/tests/ComplexLists.xml
Index: ComplexLists.xml
===================================================================
<test>
<name>ComplexLists</name>
<description>ComplexLists</description>
<clientLang>cpp</clientLang>
<clientCode>ComplexListsClient.cpp</clientCode>
<wsdl>ComplexLists.wsdl</wsdl>
<expected>
<output>
ComplexLists.expected
</output>
</expected>
<endpoint>http://localhost/ComplexLists/services/ComplexLists</endpoint>
</test>
1.1 ws-axis/c/tests/auto_build/testcases/wsdls/ComplexLists.wsdl
Index: ComplexLists.wsdl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://complexlist.test.apache.org" xmlns:impl="http://complexlist.test.apache.org" xmlns:intf="http://complexlist.test.apache.org" xmlns:tns2="http://complexlistservice.test.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://complexlistservice.test.apache.org" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://complexlistImpl.test.apache.org" xmlns:intf="http://complexlistIntf.test.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<complexType name="m_list">
<sequence>
<element maxOccurs="unbounded" name="item" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="attrlist">
<sequence>
<element maxOccurs="unbounded" name="item" nillable="true" type="tns2:namepair"/>
</sequence>
</complexType>
<complexType name="namepair">
<sequence>
<element name="m_list" nillable="true" type="tns2:m_list"/>
<element name="name" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="attrlisterr">
<sequence>
<element name="attrlist" nillable="true" type="tns2:attrlist"/>
<element name="errorcode" type="xsd:int"/>
<element name="errortext" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://complexlist.test.apache.org" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://complexlistImpl2.test.apache.org" xmlns:intf="http://complexlistIntf2.test.apache.org" xmlns:tns2="http://complexlistservice.test.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://complexlistservice.test.apache.org"/>
<element name="multilist">
<complexType>
<sequence>
<element name="arg_0_0" nillable="true" type="tns2:m_list"/>
<element name="arg_1_0" nillable="true" type="tns2:attrlist"/>
</sequence>
</complexType>
</element>
<element name="multilistResponse">
<complexType>
<sequence>
<element name="multilistReturn" nillable="true" type="tns2:attrlisterr"/>
</sequence>
</complexType>
</element>
<element name="multilistnil">
<complexType>
<sequence>
<element name="arg_0_3" nillable="true" type="tns2:m_list"/>
<element name="arg_1_3" nillable="true" type="tns2:attrlist"/>
</sequence>
</complexType>
</element>
<element name="multilistnilResponse">
<complexType>
<sequence>
<element name="multilistnilReturn" nillable="true" type="tns2:attrlisterr"/>
</sequence>
</complexType>
</element>
<element name="complexlist">
<complexType>
<sequence>
<element name="arg_0_2" nillable="true" type="tns2:attrlist"/>
<element name="arg_1_2" nillable="true" type="xsd:string"/>
<element name="arg_2_2" nillable="true" type="tns2:attrlist"/>
</sequence>
</complexType>
</element>
<element name="complexlistResponse">
<complexType>
<sequence>
<element name="complexlistReturn" nillable="true" type="tns2:attrlisterr"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="complexlistResponse">
<wsdl:part element="impl:complexlistResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="complexlistRequest">
<wsdl:part element="impl:complexlist" name="parameters"/>
</wsdl:message>
<wsdl:message name="multilistRequest">
<wsdl:part element="impl:multilist" name="parameters"/>
</wsdl:message>
<wsdl:message name="multilistResponse">
<wsdl:part element="impl:multilistResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="multilistnilRequest">
<wsdl:part element="impl:multilistnil" name="parameters"/>
</wsdl:message>
<wsdl:message name="multilistnilResponse">
<wsdl:part element="impl:multilistnilResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="ComplexLists">
<wsdl:operation name="multilist">
<wsdl:input message="impl:multilistRequest" name="multilistRequest"/>
<wsdl:output message="impl:multilistResponse" name="multilistResponse"/>
</wsdl:operation>
<wsdl:operation name="multilistnil">
<wsdl:input message="impl:multilistnilRequest" name="multilistnilRequest"/>
<wsdl:output message="impl:multilistnilResponse" name="multilistnilResponse"/>
</wsdl:operation>
<wsdl:operation name="complexlist">
<wsdl:input message="impl:complexlistRequest" name="complexlistRequest"/>
<wsdl:output message="impl:complexlistResponse" name="complexlistResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ComplexListsSoapBinding" type="impl:ComplexLists">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="multilist">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="multilistRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="multilistResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="multilistnil">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="multilistnilRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="multilistnilResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="complexlist">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="complexlistRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="complexlistResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ComplexListsService">
<wsdl:port binding="impl:ComplexListsSoapBinding" name="ComplexLists">
<wsdlsoap:address location="http://localhost:9080/ComplexLists/services/ComplexLists"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>