Using Linux / gcc / gsoap to call MBT SoapInput Node in Message Flow
Firstly download, configure, compile and install gsoap
Step 1: get up and running
mkdir gsoap
wget http://sourceforge.net/projects/gsoap2/files/gSOAP/gSOAP%202.7.16%20stable/gsoap_2.7.16.zip/download
cd /root/gsoap/gsoap-2.7
yum install byacc
yum install bison
yum install flex
./configure
./make
./make install
Step 2: Setup working folder and create stubs from remote wsdl via URL. Note I'm just using plain old C and not C++.
mkdir ./OrderService
wsdl2h -c -o OrderService.h http://83.71.23.20:7800/acmeOrders/WADDR/ProcessOrders?wsdl
Step 1: get up and running
mkdir gsoap
wget http://sourceforge.net/projects/gsoap2/files/gSOAP/gSOAP%202.7.16%20stable/gsoap_2.7.16.zip/download
cd /root/gsoap/gsoap-2.7
yum install byacc
yum install bison
yum install flex
./configure
./make
./make install
Step 2: Setup working folder and create stubs from remote wsdl via URL. Note I'm just using plain old C and not C++.
mkdir ./OrderService
wsdl2h -c -o OrderService.h http://83.71.23.20:7800/acmeOrders/WADDR/ProcessOrders?wsdl
soapcpp2 -c OrderService.h
Step 3: Create your test C client using your fav editor (mine vi)
#include "soapH.h"
#include "OrderServiceSOAP.nsmap"
main()
{
struct soap *soap = soap_new();
struct _ns1__submitPORequest request;
struct _ns1__submitPOResponse response;
request.partNo="1234";
request.partQuantity=1;
request.personName.firstName="Trevor";
request.personName.lastName="Trevor";
request.address.street="Abbeydorney";
request.address.city="Tralee";
request.address.zipCode="N/A";
soap_call___ns2__submitPO(soap,NULL,NULL,&request,&response);
printf("\nPart No: %s",response.partNo);
printf("\nQuantity: %d",response.partQuantity);
printf("\nOrder Status: %s",response.orderStatus);
printf("\nOrder Amount: %d",response.orderAmt);
soap_end(soap);
soap_free(soap);
}
Step 4: Compile
gcc TestSoap.c soapC.c soapClient.c -lgsoap -o TestSoap
Step 5: Run
./TestSoap
The output
Part No: 1234
Quantity: 1
Order Status: AVAILABLE
Order Amount: 50
Comments
Post a Comment