Hi Michael, I encountered the same problem some time ago and I solved it by dynamically allocating the memory for the string variable, inside the function:
char *s=(char*)malloc(SIZE+1); // Don't forget to add +1 for the final \0 character strcpy(s,"STRING"); I think this happens because the "...._set_return" will just copy the pointer address, which is no longer available when you exit the function. Hope this helps, Vasile -----Original Message----- From: Michael Sutter <[EMAIL PROTECTED]> To: Apache AXIS C User List <[email protected]> Date: Mon, 10 Sep 2007 18:28:01 +0200 Subject: string return param from service Hello list, I have a problem with a service having a string input and return parameter. The problem is that the return string is only initialized when the given string is a global variable. If I declare the string inside the service method I always get NULL on my client side. Does anybody know how to declare and return the string inside the service right? Below you can find the service implementation. Regards Michael #include "axis2_skel_TestService.h" #include "myadd.h" #include <string.h> char returnString[] = "version 0.0.1"; adb_versionResponse_t* axis2_skel_TestService_version (const axutil_env_t *env , adb_version_t* version ) { printf("string %s \n", adb_version_get_input(version, env)); adb_versionResponse_t* return_node = adb_versionResponse_create(env ); adb_versionResponse_set_return(return_node, env, returnString); return return_node; } Prezentul mesaj si orice fisier atasat constituie informatie confidentiala si este proprietatea exclusiva a INFLPR. Mesajul se adreseaza numai persoanei fizice sau juridice mentionata ca destinatara, precum si persoanelor autorizate sa-l primeasca. In cazul in care nu sunteti destinatarul vizat sau persoana autorizata sa primiti acest mesaj , va aducem la cunostinta ca dezvaluirea, copierea, distribuirea sau initierea unor actiuni pe baza prezentei informatii sunt strict interzise si atrag raspunderea dvs. civila si penala. Daca ati primit acest mesaj dintr-o eroare, va rugam sa ne anuntati imediat si sa-l stergeti apoi din sistemul dvs. Nu putem garanta ca transmisia acestui mesaj este securizata sau fara erori. This message and any files or documents attached are classified as INFLPR confidential and Proprietary Information. It is intended only for the individual or entity named and others authorized to receive it. If you are not the intended recipient or authorized to receive it, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately then delete it from your system.Please also note that transmission cannot be guaranteed to be secure or error-free.
