Results 1 to 5 of 5
  1. #1

    Help With Web Services Using DP


    I have a small dilemma. I am using QTP 10, and I am trying to get a request from web service WSDL. I want to do this via descriptive programming as opposed to using the Web services addin wizard.

    I use the following logic:

    sWSDL = "title:=http://www.tester.com/test?wsdl"
    sService = "service:=something"
    sPort = "port:=xxxx"

    Set oWS = WebService(sWSDL, sService, sPort)

    How do I access the SOAP Requests that are already associated with this WSDL using QTP DP? Is there a function/API or anything specific that I could use to get the SOAP Request XML?

    I am aware of the XMLWarehouse ability that comes with the web services addin, but I want to use strictly code.

    Help much appreciated. Thank you

  2. #2

    Re: Help With Web Services Using DP

    You can use the below code:

    sSoapheaderpath="H:\Vijay\TestFiles\Soap_request.x ml"

    set ssr0XML = XMLUtil.CreateXMLFromFile(sSoapheaderpath)
    XMLstr = ssr0XML.ToString

    webservice(oWS).sendrequest(<wsmethod>,XMLst r)
    msgbox webservice(oWS).lastresponse

  3. #3
    Join Date
    Sep 2001
    Doncaster, UK

    Re: Help With Web Services Using DP

    Usually when I make a DP call to a WebSevice I would include the Webservice URL, Webervice name & Webservice port as you have done. I would usually expect to pass some calling params depending on what the Webservice is expecting.

    My DP definition and call would be something like:

    <font class="small">Code:</font><hr /><pre>
    p1 = "wsdl:="
    ' Define service &amp; port
    p2 = "service:=nameOfWebservice"
    p3 = "port:=portOfWebservice"

    p4 = "Select * From CUST Where UST_ID = '123456789'"

    dataFromWebservice = WebService(p1,p2,p3).WSIDwhichMayOrMaynotBeRequire d(p4)

    If err.number &lt;&gt; 0 Then
    .... Do Webservice error process
    .... Process data returned to dataFromWebservice
    End If
    </pre><hr />

    Mark Smith.

  4. #4

    Re: Help With Web Services Using DP

    Looked at both responses.

    VijayCG, I do not want to use any external XML sources like creating an xml or "sSoapheaderpath="H:\Vijay\TestFiles\Soap_request. xml". I just want to somehow access the SOAP requests that are currently associated with my WSDL URL. Somehow, I just cannot access the requests using DP.

    mwsrosso, I do not quite understand the code you pasted there. What is p4, and where did it come from? As mentioned in my posts, I just want to access the SOAP requests (it is in XML) from the WSDL using DP.

    Can anyone please help?

  5. #5
    Join Date
    Sep 2001
    Doncaster, UK

    Re: Help With Web Services Using DP

    p4 is one of the parameters the Webservice I am calling expects.

    The webservice I am calling makes SQL calls to a protected database (one that I cannot access directly from QTP via an ODBC call) I call the Webservice passing my SQL query and it passes me back the returned records in XML.

    I called the second part of the call WSIDwhichMayOrMaynotBeRequired as you may not need to pass anything to your Webservice.

    I just wanted to show you a DP example of a Webservice call that works for me.

    Mark Smith.



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 06:01 PM.

Copyright BetaSoft Inc.