Article View: borland.public.cppbuilder.webservices.soap
Article #79Problem Deserializing Array Of Objects
From: Jair Karim Tinoco
Date: Fri, 04 May 2007 01:52
Date: Fri, 04 May 2007 01:52
235 lines
8390 bytes
8390 bytes
Hi,
I have a web service that returns an array of objects, response XML is like
the next:
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0
date=200610162339)/Tomcat-5.5
Set-Cookie: JSESSIONID=BFB5459D61DC197FBBC4DF43CF9FA080; Path=/
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 04 May 2007 00:11:12 GMT
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header/>
<env:Body>
<ns1:encuentraPaisesResponse xmlns:ns1='http://model.siiu.com/jaws'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<ns1:result>
<ns1:abrev xmlns:ns1='http://model.siiu.com/jaws'>MEX</ns1:abrev>
<ns1:idpais xmlns:ns1='http://model.siiu.com/jaws'>MX</ns1:idpais>
<ns1:nombre xmlns:ns1='http://model.siiu.com/jaws'>MEXICO</ns1:nombre>
</ns1:result>
<ns1:result>
<ns1:abrev xmlns:ns1='http://model.siiu.com/jaws'>USA</ns1:abrev>
<ns1:idpais xmlns:ns1='http://model.siiu.com/jaws'>US</ns1:idpais>
<ns1:nombre xmlns:ns1='http://model.siiu.com/jaws'>ESTADOS
UNIDOS</ns1:nombre>
</ns1:result>
</ns1:encuentraPaisesResponse>
</env:Body>
</env:Envelope>
SOAP runtime in Delphi works perfectly but in C++ doesn't, as you can see my
web service is DOCUMENT/LITERAL style, i'm using fixed SOAP Runtime from
Pascal Units provided from Bruneau Babet, i'mm working with BDS2006.
The generated files by wsdlimp.exe for C++ are:
PaisFacade.cpp
// ************************************************************************
//
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl
// >Import : http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl:0
// >Import : http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl:1
// (03/05/2007 08:36:07 p.m. - - $Rev: 5569 $)
// ************************************************************************
//
#include <vcl.h>
#pragma hdrstop
#if !defined(PaisFacadeH)
#include "PaisFacade.h"
#endif
namespace NS_PaisFacade {
_di_PaisFacade GetPaisFacade(bool useWSDL, AnsiString addr, THTTPRIO*
HTTPRIO)
{
static const char* defWSDL=
"http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl";
static const char* defURL =
"http://Contabilidad:8080/SiiuEJBModule/PaisFacade";
static const char* defSvc = "PaisFacadeService";
static const char* defPrt = "PaisFacadePort";
if (addr=="")
addr = useWSDL ? defWSDL : defURL;
THTTPRIO* rio = HTTPRIO ? HTTPRIO : new THTTPRIO(0);
if (useWSDL) {
rio->WSDLLocation = addr;
rio->Service = defSvc;
rio->Port = defPrt;
} else {
rio->URL = addr;
}
_di_PaisFacade service;
rio->QueryInterface(service);
if (!service && !HTTPRIO)
delete rio;
return service;
}
// ************************************************************************
//
// This routine registers the interfaces and types used by invoke the SOAP
// Service.
// ************************************************************************
//
static void RegTypes()
{
/* PaisFacade */
InvRegistry()->RegisterInterface(__interfaceTypeinfo(PaisFacade),
L"http://facade.siiu.com/jaws", L"");
InvRegistry()->RegisterDefaultSOAPAction(__interfaceTypeinfo(PaisFacade),
L"");
InvRegistry()->RegisterInvokeOptions(__interfaceTypeinfo(PaisFacade),
ioDocument);
/* Pais */
RemClassRegistry()->RegisterXSClass(__classid(Pais),
L"http://model.siiu.com/jaws", L"Pais");
RemClassRegistry()->RegisterXSInfo(__arrayTypeinfo(Array_Of_Pais),
L"http://model.siiu.com/jaws", L"Array_Of_Pais");
}
#pragma startup RegTypes 32
}; // NS_PaisFacade
And PaisFacade.h
// ************************************************************************
//
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl
// >Import : http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl:0
// >Import : http://localhost:8080/SiiuEJBModule/PaisFacade?wsdl:1
// (03/05/2007 08:36:07 p.m. - - $Rev: 5569 $)
// ************************************************************************
//
#ifndef PaisFacadeH
#define PaisFacadeH
#include <System.hpp>
#include <InvokeRegistry.hpp>
#include <XSBuiltIns.hpp>
#include <SOAPHTTPClient.hpp>
#if !defined(SOAP_REMOTABLE_CLASS)
#define SOAP_REMOTABLE_CLASS __declspec(delphiclass)
#endif
#if !defined(AS_UNBOUNDED)
#define AS_UNBOUNDED false
#endif
#if !defined(AS_ATTRIBUTE)
#define AS_ATTRIBUTE false
#endif
namespace NS_PaisFacade {
// ************************************************************************
//
// The following types, referred to in the WSDL document are not being
represented
// in this file. They are either aliases[@] of other types represented or
were referred
// to but never[!] declared in the document. The types from the latter
category
// typically map to predefined/known XML or Borland types; however, they
could also
// indicate incorrect WSDL documents that failed to declare or import a
schema type.
// ************************************************************************
//
// !:string - "http://www.w3.org/2001/XMLSchema"
class SOAP_REMOTABLE_CLASS Pais;
// ************************************************************************
//
// XML : Pais, global, <complexType>
// Namespace : http://model.siiu.com/jaws
// ************************************************************************
//
class Pais : public TRemotable {
private:
WideString Fabrev;
WideString Fidpais;
WideString Fnombre;
public:
__published:
__property WideString abrev = { read=Fabrev, write=Fabrev };
__property WideString idpais = { read=Fidpais, write=Fidpais };
__property WideString nombre = { read=Fnombre, write=Fnombre };
};
typedef DynamicArray<Pais*> Array_Of_Pais; /*
"http://model.siiu.com/jaws"[Gblunbnd] */
// ************************************************************************
//
// Namespace : http://facade.siiu.com/jaws
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : PaisFacadeBinding
// service : PaisFacadeService
// port : PaisFacadePort
// URL : http://Contabilidad:8080/SiiuEJBModule/PaisFacade
// ************************************************************************
//
__interface INTERFACE_UUID("{02E77375-C84D-5824-603C-964313FAE390}")
PaisFacade : public IInvokable
{
public:
virtual void actualizaPais(const Pais* Pais_1) = 0;
virtual void borraPais(const Pais* Pais_1) = 0;
virtual void creaPais(const Pais* Pais_1) = 0;
virtual Pais* encuentraPais(const WideString String_1) = 0;
virtual Array_Of_Pais encuentraPaises() = 0;
};
typedef DelphiInterface<PaisFacade> _di_PaisFacade;
_di_PaisFacade GetPaisFacade(bool useWSDL=false, AnsiString addr="",
THTTPRIO* HTTPRIO=0);
}; // NS_PaisFacade
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace NS_PaisFacade;
#endif
#endif // PaisFacadeH
Works the same Delphi runtime for C++ application? or i need other SOAP
runtime for C++.
Somebody have any idea?
Thanks in advance!!
Jair Karim
Technical Details
Message-ID:
<463a91ef@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11096a,d3fae8617f67aeb0,start X-Google-Attributes: gid11096a,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Jair Karim Tinoco" <jktinoco@evolucionti.com.mx> Newsgroups: borland.public.cppbuilder.webservices.soap Subject: Problem Deserializing Array Of Objects Date: Thu, 3 May 2007 20:52:36 -0500 Lines: 236 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6000.16386 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16386 NNTP-Posting-Host: 189.168.139.174 Message-ID: <463a91ef@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1178243567 189.168.139.174 (3 May 2007 18:52:47 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail