Results 1 to 4 of 4
  1. #1

    How to parameterise method on calling a webservice


    I need some inputs on how we can parameterise a Webservice method whend sending the request.
    I have used the code below, highlighting what i need to parameterize.

    fcallWS "TemperatureConvert","CelciustoFahrenheit"

    sub fcallWS(wsname,wsfunction)
    select case wsfunction
    case 1
    wsfunction=webservice(wsname). wsfunction (param1)

    case 2
    wsfunction=webservice(wsname).wsfunction(param1, param2,..)

    end select
    end sub
    ************************************************** ***

    In the above code, I am able to parameterize the webservice(wsname) name as its added as a object to the local repository and hence passing the same object.
    And the second parameter is the method that i want to call in the webservice which i am not able to parameterise thereby using SELECT CASE statement, but in my application there are huge number of webservices and many methods associated to each webservice.

    Hence request you to provide inputs on how I can parameterise the wsfunction for the line below
    wsfunction=webservice(wsname). wsfunction (param1)


  2. #2

    Re: How to parameterise method on calling a webservice


    Could you please explain the issue in detail?

    1) Are you getting an error while returning value in wsfunction=webservice(wsname).wsfunction(param1) or the other code?

    2) Or, if the return value is assigned correctly then are you not able to read is after it exits from the function?

    3) Or, are you not sure what Param1 or Param2, etc would be?

    4) Or, are you referring to the values of Param1, etc to be fetched from the Parameters of the Action?
    "life is simple if you can see both sides of a coin" - by me

  3. #3

    Re: How to parameterise method on calling a webservice


    I am getting syntax error for the below line of code as it can't replace .wsfunction(param1) as .CelciustoFahrenheit(param1)


    in the above line - i am not able to use the variable wsfunction directly, instead i have to use
    wsfunction=webservice(wsname).CelciustoFahrenheit( param1)

    So here i am able to parameterise wsname as it is a object and passing the object to the function.
    But not able to parameterize the method that i have to execute in that webservice - the reason why i want to parameterize is I have almost 40-50 WEbservices and 2-3 methods associated with each webservice. So if I am using
    "wsfunction=webservice(wsname).CelciustoFahrenheit (param1)"
    this line, I have to write a seperate case for each method so almost 150+ cases.

    Also let me know how can I pass parameters(if possible) for wsfunction via the below line of code - which can resolve my issue:
    set wsfunction=webservice(wsname).sendrequest(wsfuncti on, soapmessage)

    Note: i Got the above line of code from QTP help but couldnt find a way to pass parameters for the method/fucntion that is executed. like CelciustoFahrenheit(25)


  4. #4

    Re: How to parameterise method on calling a webservice

    Can anyone help me out for the above issue



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 03:39 PM.

Copyright BetaSoft Inc.