Return-Path: Delivered-To: apmail-ws-axis-c-user-archive@www.apache.org Received: (qmail 15434 invoked from network); 7 Jun 2004 10:42:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Jun 2004 10:42:04 -0000 Received: (qmail 70335 invoked by uid 500); 7 Jun 2004 10:42:03 -0000 Delivered-To: apmail-ws-axis-c-user-archive@ws.apache.org Received: (qmail 70309 invoked by uid 500); 7 Jun 2004 10:42:03 -0000 Mailing-List: contact axis-c-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: "Apache AXIS C User List" Reply-To: "Apache AXIS C User List" Delivered-To: mailing list axis-c-user@ws.apache.org Received: (qmail 70292 invoked by uid 99); 7 Jun 2004 10:42:03 -0000 Received: from [195.78.2.40] (HELO experian-scorex.com) (195.78.2.40) by apache.org (qpsmtpd/0.27.1) with ESMTP; Mon, 07 Jun 2004 03:42:03 -0700 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: RE: [OT] Passing strings to and from C++ App Date: Mon, 7 Jun 2004 12:41:17 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [OT] Passing strings to and from C++ App Thread-Index: AcRKdbg13pYCZMACSJaER/EKsG/h2ACBdUzQ From: "Stephane Antonietti" To: "Apache AXIS C User List" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi=20 Using this method of allocating memory is very dangerous : char* return_value =3D "error"; Indeed, return_value has an allocated size of 6 bytes including the null character. If the response is longer than 6, you get a buffer overrun. Increase the size of the return_value buffer, and the things should go better. Regards, Stephane Stephane Antonietti Sr Technical Consultant Experian-Scorex, Monaco ----------------------------------------------- stephane@experian-scorex.com www.experian-scorex.com -----Original Message----- From: bsouther@fwdco.com [mailto:bsouther@fwdco.com]=20 Sent: Friday, June 04, 2004 10:55 PM To: Apache AXIS C User List Subject: [OT] Passing strings to and from C++ App Not an experienced C/C++ developer I'm not sure what the best way to pass strings back and forth from a c app to an Axis Client. The following app works with a char* but then displays an=20 assertion error (below). Can anyone tell me what I'm doing wrong here? Do I need to declare my own=20 xsd__string types and do a conversion? If so, are there any examples of how=20 to do so out there? =20 Thanks in advance. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Error Message =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Debug Assertion Failed! Program: D:\axis-clients\EchoCaps\Release\EchoCaps.exe File: dbgheap.c Line: 1011 Expression: _CrtIsValidHeapPointer(pUserData) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D My Code =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include "EchoCaps.h" #include #define ENDPOINT] =3D "http://192.168.0.103:8888/file_manager/services/EchoCaps"; bool CallBase::bInitialized; CallFunctions CallBase::ms_VFtable; EchoCaps::EchoCaps(){ m_pCall =3D new Call(); m_pCall->SetProtocol(APTHTTP); m_pCall->SetEndpointURI(ENDPOINT); } EchoCaps::~EchoCaps(){ delete m_pCall; } char* EchoCaps::capitalize(xsd__string inputString){ char* return_value =3D "error"; if (AXIS_SUCCESS !=3D m_pCall->Initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL))=20 return "failed to initialize" ;=09 =09 m_pCall->SetTransportProperty(SOAPACTION_HEADER , "EchoCaps#capitalize"); m_pCall->SetSOAPVersion(SOAP_VER_1_1); m_pCall->SetOperation("capitalize", ENDPOINT); m_pCall->AddParameter((void*)&inputString, "inputString", XSD_STRING); =09 if (AXIS_SUCCESS =3D=3D m_pCall->Invoke()){ printf("Invocation went well\n\n"); if(AXIS_SUCCESS =3D=3D m_pCall->CheckMessage("capitalizeResponse", ENDPOINT)){=09 return_value =3D m_pCall->GetElementAsString("capitalizeResponse", ENDPOINT); m_pCall->UnInitialize(); return return_value; } =09 } m_pCall->UnInitialize(); return "End of capitalize function\n\n"; } void main(){ EchoCaps echoCaps;=09 char* input =3D "Input from C++ client";=09 printf("results: %s\n\n", echoCaps.capitalize(msg)); printf("done\n\n"); }