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

Discussion in 'ASP .Net Web Services' started by Asha, May 19, 2004.

  1. Asha

    Asha Guest

    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).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|bstrReturn",
    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
    Asha, May 19, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samuel
    Replies:
    0
    Views:
    573
    Samuel
    Jul 30, 2003
  2. Christopher Crooker

    WSE 2.0 SP1 SoapClient/Service and NAT

    Christopher Crooker, Aug 1, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    155
    Christopher Crooker
    Aug 3, 2004
  3. Jack Wright
    Replies:
    1
    Views:
    306
    Jack Wright
    Aug 25, 2004
  4. dzeaman
    Replies:
    0
    Views:
    224
    dzeaman
    Dec 24, 2005
  5. KodeCruncher
    Replies:
    2
    Views:
    232
    John Fullmer
    May 16, 2006
Loading...

Share This Page