Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Problem to invoke a method of webservice from a C++ SoapClient

Reply
Thread Tools

Problem to invoke a method of webservice from a C++ SoapClient

 
 
Asha
Guest
Posts: n/a
 
      05-19-2004
Hi,
I used SoapClient Libray provided by SQLData to invoke a method
exposed by Webservices of weblogic over HTTP.(using WSDL). I'm not
successful to complete this. If we use this library, we need only few
lines of C++ client code to talk with remote webservice. This library
provides a method called ExecuteMethod() which takes only 4 impt
parameters, 1)URL of WSDL file of the server, 2)Method to invoke
3)paramters 4) output. This method would build a soap client request
and do html encoding and send that to the server, where it is parsed &
the response would be build as a soap response and send over http.

This particular method 'ExecuteMethod()' does all the above functions.
We could see the log message also from the console window. From the
logging, am able to see that, connection to weblogic is done properly
and i cud see the soap request, html encoding etc.. but, i'm getting
problems with the response.

Let me give you the piece of code
`````````````````````````````````

TestSoapClient()
{
// initialize input parameters.
TCHAR * ppParamNames[3]={"bstrParam1", "bstrParam2", NULL};
TCHAR * ppParamValues[3]={ "My First Param", "My Second Param",
NULL};

TCHAR * pNames[1]={NULL};
TCHAR * pValues[1]={NULL};
const TCHAR * szResponse = NULL;

// create a soapagent in debug mode (mode=4)
SoapAgent *pSoapAgent= MakeSoapAgent(NULL, NULL,4);
//,"SQLDataSSL.pem");
if(pSoapAgent==NULL)
return -1;
vector<string>* pOutputValues;
HRESULT hr;

if(SUCCEEDED(hr=pSoapAgent->ExecuteMethod(
"http://localhost:7001/axis/services/jmxconnector?wsdl", // WSDL
file
"getDomains", // method name to be invoked.
pNames, // vector of input parameter names.
pValues, // vector of input parameter values.
&pOutputValues // pointer to vector of output parameters
)))
{

// print out results
int nSize = pOutputValues->size();
for(int i=0; i<nSize; i++)
_tprintf("%s\n", (*pOutputValues)[i].c_str());
// this get complete response..
szResponse = pSoapAgent->GetResponse(NULL, true);
_tprintf("Complete Reponse : \n%s\n", szResponse);
// this get the envelope
szResponse = pSoapAgent->GetResponse("Envelope", false);
_tprintf("Response Envelope : \n%s\n", szResponse);

// this get the message body
szResponse = pSoapAgent->GetResponse("Envelope|Body", false);
_tprintf("Response Body : \n%s\n", szResponse);
// this get the return variable
szResponse = pSoapAgent->GetResponse("Envelope|Body|Method1Response|bstrRe turn",
false);
_tprintf("Return Value : \n%s\n", szResponse);

// get an attachment if any, use either Content-Id or numerical
index as the first parameter.
// BYTE * pContent = pSoapAgent->GetAttachment("1", nSize);
}
else
{
// obtain error string when failed.
_tprintf ("************************************************ ***********\n");
_tprintf("Error String %s\n", pSoapAgent->GetErrorString());
}
DestroySoapAgent(pSoapAgent);

return 0;
}


Reference:
``````````
1) http://www.sqldata.com/soapclient/soapclient30.htm
The Soap Client library I use is SoapClient36c.exe.

2) http://www.soapclient.com/SoapTest.html -

This is a test html page. If we give the URL for the WSDL, it will
fetch the methods in the next page and we can provide the values for
the paramters for the methods to invoke.


I had a doubt that, since, i have given the url with localhost, how
would the remote machine identify the server machine. but, its able to
connect the server. I tested this by stopping the weblogic server. Its
not able to send the soap request message.

It would be really helpful, If somebody would provide me a solution.
If there is any other pointers, pls guide me.

Thanx,
Asha
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending DimeAttachment from a SoapClient to a SoapServer over TCP/ KodeCruncher ASP .Net Web Services 2 05-16-2006 03:15 PM
Organizing asynchronous web-service and callback using SoapClient dzeaman ASP .Net Web Services 0 12-24-2005 10:16 AM
Calling WebMethod from SoapClient api does not process umlaut character properly Jack Wright ASP .Net Web Services 1 08-25-2004 04:21 AM
WSE 2.0 SP1 SoapClient/Service and NAT Christopher Crooker ASP .Net Web Services 2 08-03-2004 08:05 PM
Invoke a method in Java webservice thro' soap call from Asp.net client. Samuel ASP .Net 0 07-30-2003 05:48 AM



Advertisments