🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.webservices.soap
Article #113

Get an Access Violation by using multidimensional Array

#113
From: Oliver Penz
Date: Fri, 29 Oct 2004 11:17
169 lines
6828 bytes
Hi Everybody,

I hope anyone can help.

We use SOAP Webservices to transmit the Result of a SQL Query, so we defined
the following statement in the wsdl file:

only the important elements
----------------------------------

<xsd:complexType name="SQLRow">
    <xsd:complexContent>
      <xsd:restriction base="soapenc:Array">
        <xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]"/>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="SQLTable">
    <xsd:complexContent>
      <xsd:restriction base="soapenc:Array">
       <xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[,]"/>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="SQLSelectResult">
    <xsd:all>
      <xsd:element name="SelectOK" type="xsd:int"/>
      <xsd:element name="Head"  type="typens:SQLRow"/>
      <xsd:element name="Table"  type="typens:SQLTable"/>
    </xsd:all>
  </xsd:complexType>

<message name="dogetSQLCreate">
  <part name="SessionID" type="xsd:int"/>
  <part name="Tabelle"  type="xsd:string"/>
</message>

<message name="getSQLCreateResponse">
  <part name="return"  type="xsd:string"/>
</message>

<operation name="getSQLSelect">
  <input message="typens:dogetSQLSelect" />
  <output message="typens:getSQLSelectResponse" />
 </operation>

--------------------------------------------

So far so good, and the WSDL Wizard from the C++Builder 6.0 Update 4 maked
the following .h File:

----------------------------------------------

typedef DynamicArray<AnsiString>  SQLRow;         /* "urn:BiosDB" */
typedef DynamicArray< DynamicArray<AnsiString> > SQLTable;       /*
"urn:BiosDB" */


// ************************************************************************
//
// Namespace : urn:BiosDB
// ************************************************************************
//
class SQLSelectResult : public TRemotable {
private:
  int             FSelectOK;
  SQLRow          FHead;
  SQLTable        FTable;
public:
__published:
  __property int          SelectOK = { read=FSelectOK, write=FSelectOK };
  __property SQLRow           Head = { read=FHead, write=FHead };
  __property SQLTable        Table = { read=FTable, write=FTable };
};

__interface INTERFACE_UUID("{4DE1BF76-AD0A-49C6-2428-0B317090487F}")
ExamplePort : public IInvokable
{
public:
  virtual SQLSelectResult* getSQLSelect(const int SessionID, const
AnsiString SQLStatement) = 0;
};

------------------------------------------

Okay and now we try it and i Get an Access Violation in the following call:

SQLSelectResult *Result = new SQLSelectResult();
 Result = BiosDB->getSQLSelect(SessionID,SQLStr);

Same Result as

SQLSelectResult *Result  = BiosDB->getSQLSelect(SessionID,SQLStr);

-----------------------------------------------

Has anoyone an idea what is wrong ??? I have no experience with this Delphi
Type  DynamicArray, normaly I take the vector Class from STL, i this
possible??


Thanks for the help...

By the way the Response File from Soap looks like:

---------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:ns1="urn:BiosDB" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <ns1:getSQLSelectResponse>
      <return xsi:type="ns1:SQLSelectResult">
        <SelectOK xsi:type="xsd:int">1</SelectOK>
        <Head SOAP-ENC:arrayType="xsd:string[4]" xsi:type="ns1:SQLRow">
          <item xsi:type="xsd:string">MIME_TYPE_ID</item>
          <item xsi:type="xsd:string">MIME_TYPE</item>
          <item xsi:type="xsd:string">DESCRIPTION</item>
          <item xsi:type="xsd:string">EXPLANATION</item>
        </Head>
        <Table SOAP-ENC:arrayType="xsd:string[6,4]" xsi:type="ns1:SQLTable">
          <item xsi:type="xsd:string">1</item>
          <item xsi:type="xsd:string">url</item>
          <item xsi:type="xsd:string">URL</item>
          <item xsi:type="xsd:string">Link auf Resource im Internet (oder
Intranet)</item>
          <item xsi:type="xsd:string">2</item>
          <item xsi:type="xsd:string">application/pdf</item>
          <item xsi:type="xsd:string">PDF-Dokument</item>
          <item xsi:type="xsd:string">(lokales) Acrobat PDF-Format</item>
          <item xsi:type="xsd:string">3</item>
          <item xsi:type="xsd:string">image/jpeg</item>
          <item xsi:type="xsd:string">JPEG</item>
          <item xsi:type="xsd:string"></item>
          <item xsi:type="xsd:string">4</item>
          <item xsi:type="xsd:string">image/gif</item>
          <item xsi:type="xsd:string"></item>
          <item xsi:type="xsd:string"></item>
          <item xsi:type="xsd:string">5</item>
          <item xsi:type="xsd:string">text/html</item>
          <item xsi:type="xsd:string">HTML</item>
          <item xsi:type="xsd:string"></item>
          <item xsi:type="xsd:string">6</item>
          <item xsi:type="xsd:string">text/plain</item>
          <item xsi:type="xsd:string">Text</item>
          <item xsi:type="xsd:string">(lokale) unformatierte
Textdatei</item>
        </Table>
      </return>
    </ns1:getSQLSelectResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

---------------------------

A lot of text and Code I know , sorry

Regards OLi

P.S.: To define an Array-type and then define again an array of this type I
get the error "empty Text node" from the C++Builder Soap Class.
Technical Details
Message-ID: <4182276e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11096a,af0a48e3afbeaf68,start
X-Google-Attributes: gid11096a,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Oliver Penz" <oli@aloha-systeme.de>
From: "Oliver Penz" <oli@aloha-systeme.de>
Newsgroups: borland.public.cppbuilder.webservices.soap
Subject: Get an Access Violation by using multidimensional Array
Date: Fri, 29 Oct 2004 13:17:00 +0200
Lines: 171
Organization: ALOHA-Systeme
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 82.82.69.54
Message-ID: <4182276e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099048814 82.82.69.54 (29 Oct 2004 04:20:14 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail