You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Bo Xie <xi...@gmail.com> on 2006/03/26 18:25:23 UTC
Ask for step-by-step guide to call "delayed quotes"
Hi,
I am a AXIS C++ newbie. Could you please tell me how to use AXIS C++
to call "http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"?
Thank you!
Best Regards,
Xie, Bo
PS. Following is a step-by-step guide to call "delayed quotes" thru gSOAP:
-----------------
0. Download gsoap_linux_2.7.6e.tar.gz
1. Write main program quote.c
----
#include "soapH.h" /* include generated proxy and SOAP support */
int main(int argc, char **argv)
{ struct soap soap;
float q;
char *sym;
if (argc > 1)
sym = argv[1];
else
{ fprintf(stderr, "Usage: quote <ticker>\n");
return -1;
}
soap_init(&soap);
if (soap_call_ns1__getQuote(&soap,
"http://services.xmethods.net/soap", NULL, sym, q) == 0)
printf("\nCompany - %s Quote - %f\n", sym, q);
else
soap_print_fault(&soap, stderr);
return 0;
}
/* The namespace mapping table is required and associates namespace
prefixes with namespace names: */
struct Namespace namespaces[] =
{
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"}, /*
MUST be first */
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"}, /*
MUST be second */
{"xsi", "http://www.w3.org/1999/XMLSchema-instance"}, /*
MUST be third */
{"xsd", "http://www.w3.org/1999/XMLSchema"},
{"ns1", "urn:xmethods-delayed-quotes"}, /* Method namespace URI */
{NULL, NULL}
};
----
2. Generate the SOAP Stub Routines
wsdl2h -s -o quote.h
http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl
soapcpp2 quote.h
cp stdsoap2.h YOURDIRECTORY/
cp stdsoap2.cpp YOURDIRECTORY/
3. Compile Your Client App
g++ -o quote quote.c soapC.cpp soapClient.cpp stdsoap2.cpp
4. Try it Out
./quote IBM
Company - IBM Quote - 82.870003
-----------------
Re: Ask for step-by-step guide to call "delayed quotes"
Posted by Adrian Dick <ad...@uk.ibm.com>.
Hi,
You will find step-by-step instructions, based on the Calculator sample
WSDL here: http://ws.apache.org/axis/cpp/clientuser-guide.html
Regards,
Adrian
_______________________________________
Adrian Dick (adrian.dick@uk.ibm.com)
"Bo Xie" <xi...@gmail.com> wrote on 26/03/2006 17:25:23:
> Hi,
>
> I am a AXIS C++ newbie. Could you please tell me how to use AXIS C++
> to call
"http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"?
> Thank you!
>
> Best Regards,
> Xie, Bo
>
> PS. Following is a step-by-step guide to call "delayed quotes" thru
gSOAP:
> -----------------
> 0. Download gsoap_linux_2.7.6e.tar.gz
>
> 1. Write main program quote.c
> ----
> #include "soapH.h" /* include generated proxy and SOAP support */
>
> int main(int argc, char **argv)
> { struct soap soap;
> float q;
> char *sym;
> if (argc > 1)
> sym = argv[1];
> else
> { fprintf(stderr, "Usage: quote <ticker>\n");
> return -1;
> }
> soap_init(&soap);
> if (soap_call_ns1__getQuote(&soap,
> "http://services.xmethods.net/soap", NULL, sym, q) == 0)
> printf("\nCompany - %s Quote - %f\n", sym, q);
> else
> soap_print_fault(&soap, stderr);
> return 0;
> }
>
> /* The namespace mapping table is required and associates namespace
> prefixes with namespace names: */
> struct Namespace namespaces[] =
> {
> {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"}, /*
> MUST be first */
> {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"}, /*
> MUST be second */
> {"xsi", "http://www.w3.org/1999/XMLSchema-instance"}, /*
> MUST be third */
> {"xsd", "http://www.w3.org/1999/XMLSchema"},
> {"ns1", "urn:xmethods-delayed-quotes"}, /* Method namespace URI
*/
> {NULL, NULL}
> };
> ----
>
> 2. Generate the SOAP Stub Routines
> wsdl2h -s -o quote.h
> http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl
> soapcpp2 quote.h
> cp stdsoap2.h YOURDIRECTORY/
> cp stdsoap2.cpp YOURDIRECTORY/
>
> 3. Compile Your Client App
> g++ -o quote quote.c soapC.cpp soapClient.cpp stdsoap2.cpp
>
> 4. Try it Out
> ./quote IBM
> Company - IBM Quote - 82.870003
> -----------------