C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Resolu] Problème avec gsoap et les std::vector

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
LePhasme
Junior Member


Joined: 25 Apr 2006
Posts: 2

PostPosted: Tue Apr 25, 2006 7:40 am    Post subject: [Resolu] Problème avec gsoap et les std::vector Reply with quote



Bonjour, j'ai un petit problème avec l'utilisation de la librairie gsoap, je dois l'utiliser pour un projet et je voudrais bien qu'une de mes fonctions renvoit un argument de type vector.
Seulement j'ai beau mettre des éléments dans le vector il ne les sérialise pas...
Je ne vois pas du tout pourquoi ca ne fonctionne pas j'ai fais la même chose que dans la documentation...

Voici le code de mon fichier .h pour les vector :
Code:

#import "stlvector.h"

typedef int xsd__int;
typedef double xsd__double;
typedef std::string xsd__string;

struct empty {} ;

class cb__Test
{
 public :
  std::vector<xsd__int> * result ;
} ;

int cb__sendRequest( xsd__string moduleName, xsd__string action, xsd__string parameters, cb__Test * response) ;


Le code du serveur :
Code:

int cb__sendRequest(struct soap *soap, string aModuleName, string action, string parameters, cb__Test * response)
{
 response = new cb__Test() ;
 response->result = new vector<int>() ;
 ...
 response->result->push_back(2);
 response->result->push_back(25) ;
 printf("nb : %d\n",response->result->at(1)) ;
 ...
 return SOAP_OK;
 }


Le message envoyé par le serveur et recu par le client :
Code:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cb="urn:combus" xmlns:hm="urn:hwMan" xmlns:ld="urn:ldap"><SOAP-ENV:Body><cb:Test></cb:Test></SOAP-ENV:Body></SOAP-ENV:Envelope>


Le tout me donnant un sympathique segfault à l'exécution quand je veut utiliser le résultat de la fonction.

Toute aide est la bienvenue.

Merci


Last edited by LePhasme on Tue Apr 25, 2006 9:48 am; edited 1 time in total
Back to top
View user's profile Send private message
LePhasme
Junior Member


Joined: 25 Apr 2006
Posts: 2

PostPosted: Tue Apr 25, 2006 9:47 am    Post subject: re:[Resolu] Problème avec gsoap et les std::vector Reply with quote



Problème résolu en renvoyant une référence et pas un pointeur, tout est sérialisé correctement de cette façon.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.