Forum Discussion

wt0vremr's avatar
wt0vremr
Occasional Contributor
9 years ago

IXMLDOMDocument in Python to call SOAP from testcomplete?

Hello. I'm usint TestComplete 11 at work. So.

Let's say I have a web service in TestComplete, called PetService.

Here's my code. I wrote it after reading TC docs related to SOAP testing.

 

 

def run():
  WebServiceInfo = WebServices.CreateWebServiceInfoFromItem("PetService")
  requestObj = WebServiceInfo.PrepareRequestObject("GetClientPets")
  requestObj['clientCode'] = 2947
  WebServiceInfo.PrepareRequest("GetClientPets", requestObj)
  

 

 

Now I need to send the request, get the response and parse it. I tried to create XmlHttpRequest, but all my attempts failed.

By the way, TestComplete documentation is still missing some useful python examples.

4 Replies

  • wt0vremr's avatar
    wt0vremr
    Occasional Contributor

    Also I tried:

      WebServiceInfo.PrepareRequest("GetClientPets", requestObj).save("C:\text.txt")

    Which gave me a .txt file containing 3 zeros.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I guess that your code is based on the http://support.smartbear.com/viewarticle/70743/ help article and you made it too complex. :)

    Manual creation of requests is a rare thing with TestComplete and may be needed for a few special cases only (e.g. when testing asynchronious web services). In all other cases Web Services Editor is very useful and assists in creation of a simple and clear test code.

    I would recommend to start from http://support.smartbear.com/viewarticle/68323/ topic and follow the recommendations.

     

    If you can post here or send me (via the forum mail) the WSDL file for your web service I can provide you with the sample code.

    • wt0vremr's avatar
      wt0vremr
      Occasional Contributor

      Unfortunately, my WSDL is internal use only, and it's illegal to expose it outside the company.

      I described my purpose above, I need ability to work with the response.

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        In this case I would recommend to go through the help section that I mentioned. Also take a look at the sample test project from the C:\Users\Public\Documents\TestComplete 11 Samples\Common\Web Service Testing\Functional Testing\ folder and use it as a sample.