title image


Smiley Re: Probleme beim nachvollziehen eines Beispiels
Hi..



Danke für deine Antwort. Bei dir klingt das wirklich nicht schwer. Um so erschreckender meine Ergebnisse.



Hier mein bisheriger Versuchsaufbau.



Der Client:

-----------



#include "soapH.h"

#include "calc.nsmap"

int main()

{

struct soap *soap = soap_new(); /* create environment */

double n; /* result value */

if (soap_call_ns__add(soap, "http://127.0.0.1/calc.cgi", NULL, 2, 3, &n) == SOAP_OK)

printf("2 plus 3 is %f\n", n);

else

soap_print_fault(soap, stderr); /* print error */

soap_end(soap); /* clean up deserialized data */

soap_done(soap); /* detach environment */

free(soap);

return 0;

}





Der Server: liegt im cgi-bin-Verzeichnis eines laufenden Apache-Servers

-----------



#include "soapH.h" /* get the gSOAP-generated definitions */

#include "calc.nsmap" /* get the gSOAP-generated namespace bindings */

#include



int main()

{ return soap_serve(soap_new()); /* call the request dispatcher */

}



int ns__add(struct soap *soap, double a, double b, double *result)

{ *result = a + b;

return SOAP_OK;

}





int ns__sub(struct soap *soap, double a, double b, double *result)

{

*result = a - b;

return SOAP_OK;

}



int ns__sqrt(struct soap *soap, double a, double *result)

{

if (a >= 0)

{ *result = a;

return SOAP_OK;

}

else

return soap_sender_fault(soap, "Square root of negative value", "I can only take the square root of non-negative values");

}





Makefile:

--------



SOAPCPP=../../gsoap-linux-2.7/stdsoap2.cpp

GSOAP=../../gsoap-linux-2.7/soapcpp2

SOAPH=../../gsoap-linux-2.7/stdsoap2.h

SOAPC=../../gsoap-linux-2.7/stdsoap2.c



CC=gcc

LIBS=





all : calc client

calc : calc.h calc.c $(SOAPH) $(SOAPC)

$(GSOAP) -c calc.h

$(CC) -o calc calc.c soapC.c soapServer.c $(SOAPC)



client: client.c $(SOAPH)

$(CC) -o client client.c soapC.c soapClient.c $(SOAPC)



clean :

-rm calc.o





Der Aufruf:

-----------



./client calc.add.req.xml



Ergebnis:

---------



SOAP FAULT: SOAP-ENV:Server

"HTTP-error"

Detail: HTTP/1.1 404 Not Found









Wie man sieht, sieht man nichts.. Hast du ein Plan, was ich falsch gemacht habe? Danke für deine Mühe..



Gruß AndreH

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: