1 pièce(s) jointe(s)
[SOAP] Serveur et client dans le même code => définitions multiples de soap_getelement
Bonjour à tous,
je suis en train d'écrire ce qui pourrait s'apparenter à un proxy service web (une première pour moi, je ne maitrise pas trop soap).
Pour résumer à l'extrême, c'est dans le cadre du changement complet d'un service soap. Le nouveau service doit "comprendre" les demandes de l'ancien service, les traduire en demandes comprises par le nouveau service et enfin rendre ce que l'ancien service rendait.
Je possède le code du nouveau service, ce dernier ne sera pas modifié mais interrogé par ce que j'appelle le proxy.
Je dispose des wsdl des anciens et nouveaux services.
Côté proxy, j'ai écris ce qu'il fallait pour qu'il se mette à l'écoute, comprenne les demandes et rende les paquets xml correspondant à l'ancien serveur.
Côté interrogation, j'ai également codé ce qu'il fallait pour interroger le service. Ca tourne nickel.
Détail, j'utilise Eclipse.
Pour les 2 services, j'ai utilisé wsdl2h et soapcpp2 pour générer le code :
Pour le proxy :
Code:
1 2 3
|
wsdl2h -o /tmp/proxy.hpp service.wsdl espoir.xsd pims.xsd
soapcpp2 -LSx -d/fs1/src/proxy /tmp/proxy.hpp |
Pour le client du nouveau service:
Code:
1 2 3
|
wsdl2h -c -o/tmp/ams.h "http://localhost:5100?wsdl"
soapcpp2 -CL -d/fs1/src/amsClient -pams -Qams /tmp/ams.h |
Pour le client, j'ai ajouté un namespace ams (-Qams) pour éviter d'avoir des définitions en doubles
J'ai commencé à avoir des soucis lorsque j'ai voulu ajouté le code du client dans le projet du proxy.
Tout se compile correctement mais j'obtiens l'erreur suivante au linkage :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
make all
Building file: ../c/amsClient/amsC.c
Invoking: Cross GCC Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c/amsClient/amsC.d" -MT"c/amsClient/amsC.o" -o "c/amsClient/amsC.o" "../c/amsClient/amsC.c"
Finished building: ../c/amsClient/amsC.c
Building file: ../c/amsClient/amsClient.c
Invoking: Cross GCC Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c/amsClient/amsClient.d" -MT"c/amsClient/amsClient.o" -o "c/amsClient/amsClient.o" "../c/amsClient/amsClient.c"
Finished building: ../c/amsClient/amsClient.c
Building file: ../c/soapC.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c/soapC.d" -MT"c/soapC.o" -o "c/soapC.o" "../c/soapC.cpp"
Finished building: ../c/soapC.cpp
Building file: ../c/soapServer.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c/soapServer.d" -MT"c/soapServer.o" -o "c/soapServer.o" "../c/soapServer.cpp"
Finished building: ../c/soapServer.cpp
Building file: ../c/stdsoap2.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c/stdsoap2.d" -MT"c/stdsoap2.o" -o "c/stdsoap2.o" "../c/stdsoap2.cpp"
Finished building: ../c/stdsoap2.cpp
Building file: ../c/workerAmaServer.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"c/workerAmaServer.d" -MT"c/workerAmaServer.o" -o "c/workerAmaServer.o" "../c/workerAmaServer.cpp"
Finished building: ../c/workerAmaServer.cpp
Building target: workerAmaServer
Invoking: Cross G++ Linker
g++ -L/fs1/git/workerAmaServer/Debug/c -o "workerAmaServer" ./c/amsClient/amsC.o ./c/amsClient/amsClient.o ./c/soapC.o ./c/soapServer.o ./c/stdsoap2.o ./c/workerAmaServer.o -lresolv -ldl
./c/soapC.o : Dans la fonction « soap_getelement » :
/fs1/git/workerAmaServer/Debug/../c/soapC.cpp:186 : définitions multiples de « soap_getelement »
./c/amsClient/amsC.o:/fs1/git/workerAmaServer/Debug/../c/amsClient/amsC.c:187 : défini pour la première fois ici
./c/soapC.o : Dans la fonction « soap_putelement » :
/fs1/git/workerAmaServer/Debug/../c/soapC.cpp:375 : définitions multiples de « soap_putelement »
./c/amsClient/amsC.o:/fs1/git/workerAmaServer/Debug/../c/amsClient/amsC.c:644 : défini pour la première fois ici
./c/soapC.o : Dans la fonction « soap_markelement » :
/fs1/git/workerAmaServer/Debug/../c/soapC.cpp:437 : définitions multiples de « soap_markelement »
./c/amsClient/amsC.o:/fs1/git/workerAmaServer/Debug/../c/amsClient/amsC.c:893 : défini pour la première fois ici
makefile:46 : la recette pour la cible « workerAmaServer » a échouée
collect2: error: ld returned 1 exit status |
En effet, soap_getelement, soap_putelement et soap_markelement sont définies dans les 2 sources mais il y a un namespace spécifique dans amsC.c
N'est ce pas suffisant ? Si quelqu'un avait une piste, cela m'aiderait bien.
Je joins les sources aux messages. Tout y est, sauf les urls :D
Merci d'avance.