Hi Group,
I built a gSoap 2.7.11 Web services client in C++ on AIX and have got
it talking to the remote service. The service is sending back an
array of objects to my client but the client is unable to decode it.
The client seems to be having a problem with the "item" tag element
that is used to wrap the sequence of array objects.
The SOAP call returns a SOAP_OK - no exception or error returned to
the client. The returned XML looks good except for the <item/> tag
wrapping each array object (which gSoap doesn't like).
Section 10.11.2 in the gSoap documentation talks about removing the
namespace part of the array wrapper class so I made this change in
the soapcpp2 input file but it has made no difference.
Would really appreciate some help on this.
Thanks a lot,
Paul.
Paulc - The returned XML response is valid according to the schema:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/" xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/" xmlns:xsd="http//www.w3.org/2001/XMLSchema" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<soapenv:Head er/>
<soapenv:Body >
<accountValuati onResponse xsi:type="soape nc:Array" soapenc:arrayTy pe="ns-1550380365:Acco untValuationSum mary[1]" xmlns:ns-1550380365="htt p://xmlns.fid-intl.com/smt/valuation/valuation/1.0" xmlns="http://xmlns.fid-intl.com/smt/valuation/valuationServic e/1.0">
<item xmlns=""> <currencyCode>G BP</currencyCode>
<productGroupCo de>CMA </productGroupCod e>
<netValue>500.0 0</netValue>
<accountType> M</accountType>
<policyNumber xsi:nil="true"/>
<designation xsi:nil="true"/>
</item>
</accountValuatio nResponse>
</soapenv:Body>
</soapenv:Envelop e>
Paulc - Heres the relevant part of the gsoap decode XML log. I’ve highlighted where it starts going wrong.
Push OK ('' matches 'ns3' in namespace table)
Tags and (default) namespaces match: 'xsi:type' 'xsi:type'
Tags and (default) namespaces match: 'soapenc:arrayT ype' 'SOAP-ENC:arrayType'
Tags and (default) namespaces match: 'accountValuati onResponse' 'ns3:accountVal uationResponse'
Begin element found (level=3) 'accountValuati onResponse'='ns 3:accountValuat ionResponse'
[B]Enter id='' type=9 loc=2ff09f38 size=16 level=0
stdsoap2.cpp(27 47): malloc(21) = 20039bc8
Push namespace binding (level=3) '' ''
Push NOT OK: no match found for '' in namespace mapping table (added to stack anyway)
Unexpected element 'item' in input (level=3, 1)
IGNORING element 'item'
stdsoap2.cpp(82 15): malloc(27) = 20039c08
stdsoap2.cpp(82 69): malloc(256) = 20039c58
Tags and (default) namespaces match: 'xsi:nil' 'xsi:nil'
Unexpected element 'currencyCode' in input (level=4, 0)
IGNORING element 'currencyCode'
Unexpected element 'productGroupCo de' in input (level=4, 1)
IGNORING element 'productGroupCo de'
End element found (level=5) 'productGroupCo de'=''
Paulc – heres the generated decode classes without the changes suggested in the gsoap manual.
(I tried renaming AccountValuatio nSummary to AccountValuatio nSummaryitem and changed _ns3__accountVa luationResponse to accountValuatio nResponse in the input .h file to soapcpp2, but it still fails as above)
class SOAP_CMAC _ns3__accountVa luationResponse
{
public:
int __sizeAccountVa luationSummary;
class ns4__AccountVal uationSummary **AccountValuat ionSummary;
struct soap *soap;
public:
virtual int soap_type() const { return 9; } /* = unique id SOAP_TYPE__ns3_ _accountValuati onResponse */
virtual void soap_default(st ruct soap*);
virtual void soap_serialize( struct soap*) const;
......STD SOAP STUFF
_ns3__accountVa luationResponse () : __sizeAccountVa luationSummary( 0), AccountValuatio nSummary(NULL), soap(NULL) { }
virtual ~_ns3__accountV aluationRespons e() { }
};
Paulc – Heres the structure itself
class SOAP_CMAC ns4__AccountVal uationSummary
{
public:
char *currencyCode; /* optional element of type xsd:string */
char *productGroupCo de; /* optional element of type xsd:string */
char *netValue; /* optional element of type xsd:decimal */
char *accountType; /* optional element of type xsd:string */
ETC....
char *designation; /* optional element of type xsd:string */
struct soap *soap; /* transient */
public:
virtual int soap_type() const { return 15; } /* = unique id SOAP_TYPE_ns4__ AccountValuatio nSummary */
virtual void soap_default(st ruct soap*);
virtual void soap_serialize( struct soap*) const;
virtual int soap_put(struct soap*, const char*, const char*) const;
virtual int soap_out(struct soap*, const char*, int, const char*) const;
virtual void *soap_get(struc t soap*, const char*, const char*);
virtual void *soap_in(struct soap*, const char*, const char*);
ns4__AccountVal uationSummary() : currencyCode(NU LL), productGroupCod e(NULL), netValue(NULL), accountType(NUL L), policyNumber(NU LL), primaryAccOwner Surname(NULL), re
gisteredAccount Number(NULL), primaryAccOwner Title(NULL), primaryAccOwner FirstName(NULL) , designation(NUL L), soap(NULL) { }
virtual ~ns4__AccountVa luationSummary( ) { }
};
I built a gSoap 2.7.11 Web services client in C++ on AIX and have got
it talking to the remote service. The service is sending back an
array of objects to my client but the client is unable to decode it.
The client seems to be having a problem with the "item" tag element
that is used to wrap the sequence of array objects.
The SOAP call returns a SOAP_OK - no exception or error returned to
the client. The returned XML looks good except for the <item/> tag
wrapping each array object (which gSoap doesn't like).
Section 10.11.2 in the gSoap documentation talks about removing the
namespace part of the array wrapper class so I made this change in
the soapcpp2 input file but it has made no difference.
Would really appreciate some help on this.
Thanks a lot,
Paul.
Paulc - The returned XML response is valid according to the schema:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/" xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/" xmlns:xsd="http//www.w3.org/2001/XMLSchema" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<soapenv:Head er/>
<soapenv:Body >
<accountValuati onResponse xsi:type="soape nc:Array" soapenc:arrayTy pe="ns-1550380365:Acco untValuationSum mary[1]" xmlns:ns-1550380365="htt p://xmlns.fid-intl.com/smt/valuation/valuation/1.0" xmlns="http://xmlns.fid-intl.com/smt/valuation/valuationServic e/1.0">
<item xmlns=""> <currencyCode>G BP</currencyCode>
<productGroupCo de>CMA </productGroupCod e>
<netValue>500.0 0</netValue>
<accountType> M</accountType>
<policyNumber xsi:nil="true"/>
<designation xsi:nil="true"/>
</item>
</accountValuatio nResponse>
</soapenv:Body>
</soapenv:Envelop e>
Paulc - Heres the relevant part of the gsoap decode XML log. I’ve highlighted where it starts going wrong.
Push OK ('' matches 'ns3' in namespace table)
Tags and (default) namespaces match: 'xsi:type' 'xsi:type'
Tags and (default) namespaces match: 'soapenc:arrayT ype' 'SOAP-ENC:arrayType'
Tags and (default) namespaces match: 'accountValuati onResponse' 'ns3:accountVal uationResponse'
Begin element found (level=3) 'accountValuati onResponse'='ns 3:accountValuat ionResponse'
[B]Enter id='' type=9 loc=2ff09f38 size=16 level=0
stdsoap2.cpp(27 47): malloc(21) = 20039bc8
Push namespace binding (level=3) '' ''
Push NOT OK: no match found for '' in namespace mapping table (added to stack anyway)
Unexpected element 'item' in input (level=3, 1)
IGNORING element 'item'
stdsoap2.cpp(82 15): malloc(27) = 20039c08
stdsoap2.cpp(82 69): malloc(256) = 20039c58
Tags and (default) namespaces match: 'xsi:nil' 'xsi:nil'
Unexpected element 'currencyCode' in input (level=4, 0)
IGNORING element 'currencyCode'
Unexpected element 'productGroupCo de' in input (level=4, 1)
IGNORING element 'productGroupCo de'
End element found (level=5) 'productGroupCo de'=''
Paulc – heres the generated decode classes without the changes suggested in the gsoap manual.
(I tried renaming AccountValuatio nSummary to AccountValuatio nSummaryitem and changed _ns3__accountVa luationResponse to accountValuatio nResponse in the input .h file to soapcpp2, but it still fails as above)
class SOAP_CMAC _ns3__accountVa luationResponse
{
public:
int __sizeAccountVa luationSummary;
class ns4__AccountVal uationSummary **AccountValuat ionSummary;
struct soap *soap;
public:
virtual int soap_type() const { return 9; } /* = unique id SOAP_TYPE__ns3_ _accountValuati onResponse */
virtual void soap_default(st ruct soap*);
virtual void soap_serialize( struct soap*) const;
......STD SOAP STUFF
_ns3__accountVa luationResponse () : __sizeAccountVa luationSummary( 0), AccountValuatio nSummary(NULL), soap(NULL) { }
virtual ~_ns3__accountV aluationRespons e() { }
};
Paulc – Heres the structure itself
class SOAP_CMAC ns4__AccountVal uationSummary
{
public:
char *currencyCode; /* optional element of type xsd:string */
char *productGroupCo de; /* optional element of type xsd:string */
char *netValue; /* optional element of type xsd:decimal */
char *accountType; /* optional element of type xsd:string */
ETC....
char *designation; /* optional element of type xsd:string */
struct soap *soap; /* transient */
public:
virtual int soap_type() const { return 15; } /* = unique id SOAP_TYPE_ns4__ AccountValuatio nSummary */
virtual void soap_default(st ruct soap*);
virtual void soap_serialize( struct soap*) const;
virtual int soap_put(struct soap*, const char*, const char*) const;
virtual int soap_out(struct soap*, const char*, int, const char*) const;
virtual void *soap_get(struc t soap*, const char*, const char*);
virtual void *soap_in(struct soap*, const char*, const char*);
ns4__AccountVal uationSummary() : currencyCode(NU LL), productGroupCod e(NULL), netValue(NULL), accountType(NUL L), policyNumber(NU LL), primaryAccOwner Surname(NULL), re
gisteredAccount Number(NULL), primaryAccOwner Title(NULL), primaryAccOwner FirstName(NULL) , designation(NUL L), soap(NULL) { }
virtual ~ns4__AccountVa luationSummary( ) { }
};