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

    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

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

    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);
    return -1;
    vector<string>* pOutputValues;
    HRESULT hr;

    "http://localhost:7001/axis/services/jmxconnector?wsdl", // WSDL
    "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",
    _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);
    // obtain error string when failed.
    _tprintf ("***********************************************************\n");
    _tprintf("Error String %s\n", pSoapAgent->GetErrorString());

    return 0;

    The Soap Client library I use is SoapClient36c.exe.

    2) -

    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.

    Asha, May 19, 2004
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.