473,473 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

gSoap wont decode dynamic array because of <item> tag

1 New Member
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:Envelope 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:Header/>
<soapenv:Body>
<accountValuationResponse xsi:type="soapenc:Array" soapenc:arrayType="ns-1550380365:AccountValuationSummary[1]" xmlns:ns-1550380365="http://xmlns.fid-intl.com/smt/valuation/valuation/1.0" xmlns="http://xmlns.fid-intl.com/smt/valuation/valuationService/1.0">
<item xmlns=""> <currencyCode>GBP</currencyCode>
<productGroupCode>CMA </productGroupCode>
<netValue>500.00</netValue>
<accountType>M</accountType>
<policyNumber xsi:nil="true"/>
<designation xsi:nil="true"/>
</item>
</accountValuationResponse>
</soapenv:Body>
</soapenv:Envelope>




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:arrayType' 'SOAP-ENC:arrayType'
Tags and (default) namespaces match: 'accountValuationResponse' 'ns3:accountValuationResponse'
Begin element found (level=3) 'accountValuationResponse'='ns3:accountValuationRe sponse'
[b]Enter id='' type=9 loc=2ff09f38 size=16 level=0
stdsoap2.cpp(2747): 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(8215): malloc(27) = 20039c08
stdsoap2.cpp(8269): 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 'productGroupCode' in input (level=4, 1)
IGNORING element 'productGroupCode'
End element found (level=5) 'productGroupCode'=''



Paulc – heres the generated decode classes without the changes suggested in the gsoap manual.
(I tried renaming AccountValuationSummary to AccountValuationSummaryitem and changed _ns3__accountValuationResponse to accountValuationResponse in the input .h file to soapcpp2, but it still fails as above)


class SOAP_CMAC _ns3__accountValuationResponse
{
public:
int __sizeAccountValuationSummary;
class ns4__AccountValuationSummary **AccountValuationSummary;
struct soap *soap;
public:
virtual int soap_type() const { return 9; } /* = unique id SOAP_TYPE__ns3__accountValuationResponse */
virtual void soap_default(struct soap*);
virtual void soap_serialize(struct soap*) const;
......STD SOAP STUFF
_ns3__accountValuationResponse() : __sizeAccountValuationSummary(0), AccountValuationSummary(NULL), soap(NULL) { }
virtual ~_ns3__accountValuationResponse() { }
};


Paulc – Heres the structure itself



class SOAP_CMAC ns4__AccountValuationSummary
{
public:
char *currencyCode; /* optional element of type xsd:string */
char *productGroupCode; /* 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__AccountValuationSummary */
virtual void soap_default(struct 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(struct soap*, const char*, const char*);
virtual void *soap_in(struct soap*, const char*, const char*);
ns4__AccountValuationSummary() : currencyCode(NULL), productGroupCode(NULL), netValue(NULL), accountType(NULL), policyNumber(NULL), primaryAccOwnerSurname(NULL), re
gisteredAccountNumber(NULL), primaryAccOwnerTitle(NULL), primaryAccOwnerFirstName(NULL), designation(NULL), soap(NULL) { }
virtual ~ns4__AccountValuationSummary() { }
};
Nov 12 '08 #1
0 3365

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the...
2
by: BrianP | last post by:
Hi, I have had to invent a work-around to get past what looks like a JavaScript bug, the malfunctioning Perl-like JavaScript array functions including SPLICE() and UNSHIFT(). I have boiled it...
15
by: Frances | last post by:
<html> <head> <script> function doIt() { var list = document.forms.product; var selItem = list.options.value; ^^^^^^^ </head>
0
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of...
2
by: RBohannon | last post by:
I had some help on this one earlier, but I'm still having a bit of trouble. I'm sure it's something simple that I just don't know. I'm using Access2000. I have one table with employee salary...
7
by: Russell Hind | last post by:
I want to create an array of key value pairs. This code compiles fine: KeyValuePair<string, object> kvps = { new KeyValuePair<string,object>( "int", 5 ), new KeyValuePair<string,object>(...
3
by: andrewcw | last post by:
I looked at this code on MSDN ( and at article in MSDN magazine this month ): The code below suggests that I may be able to use the find function of generics to locate the object easily as opposed...
10
by: Szabolcs Horvát | last post by:
Consider the attached example program: an object of type 'A' is inserted into a 'map<int, Am;'. Why does 'm;' call the copy constructor of 'A' twice in addition to a constructor call? The...
4
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report>...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.