Forum Discussion

praveensqa's avatar
praveensqa
Contributor
13 years ago

Adding Header to the web services in test complete

Hi ,



Can you please enable me to add  Header to the web services in test complete



Regards,

Praveen
  • Hi Alex,



    Here is the end solution.




    Function LandmarkVO

      Set ServiceInfo = WebServices.CreateWebServiceInfoFromItem("DeviceManagementService")

     

       Set HomeGprsIpVO = ServiceInfo.TypeFactory.HomeGprsIpVO

      

      HomeGprsIpVO.gprsId=null

      HomeGprsIpVO.ipAddress="192.168.1.5"

      HomeGprsIpVO.lastUpdated=""

      HomeGprsIpVO.name="Praveenhjlllllk"

      HomeGprsIpVO.port="5006"

      HomeGprsIpVO.status=1

      HomeGprsIpVO.updatedBy=null

      

       

      

      Set RequestObj = ServiceInfo.PrepareRequestObject("createHomeGPRSIP")

      Set RequestObj.args0 = HomeGprsIpVO 

      

      Set RequestXml = ServiceInfo.PrepareRequest("createHomeGPRSIP", RequestObj)

      Set Root = RequestXml.documentElement





      Set HeaderElement = RequestXml.createElement("s:Header")

      Set HeaderNode = Root.insertBefore(HeaderElement, Root.childNodes.item(0))  





      Set usernameElement = RequestXml.createNode(1, "userName", "")

      Set usernameNode = HeaderNode.appendChild(usernameElement)

      Set usernameValueElement = RequestXml.createTextNode("Admin")

      usernameNode.appendChild(usernameValueElement)

      

      Set pwdElement = RequestXml.createNode(1, "password", "")

      Set pwdNode = HeaderNode.appendChild(pwdElement)

      Set pwdValueElement = RequestXml.createTextNode("password")

      pwdNode.appendChild(pwdValueElement)





    '  Set ipaElement = RequestXml.createNode(1, "ipaddress", "")

    '  Set ipaNode = HeaderNode.appendChild(ipaElement)

    '  Set ipaValueElement = RequestXml.createTextNode("10.10.10.10")

    '  ipaNode.appendChild(ipaValueElement)

    '

    '  Set pidElement = RequestXml.createNode(1, "portalId", "")

    '  Set pidNode = HeaderNode.appendChild(pidElement)

    '  Set pidValueElement = RequestXml.createTextNode(1)

    '  pidNode.appendChild(pidValueElement)

        

      Log.Message "See XML in the Additional Information pane", RequestXml.xml

     

      ' Sending the request

      Set XmlHttpRequest = CreateObject("MSXML2.XMLHTTP.3.0")

      

      ' Insert the correct service URL

      Call XmlHttpRequest.open("POST", "https://devtest.idigi.com/mobile/services/DeviceManagementService.DeviceManagementServiceHttpSoap11Endpoint/", False)

      Call XmlHttpRequest.send(RequestXml)  

      ' Log.Message WebServices.DeviceManagementService.LastResponse

      Set ResponseXML = XmlHttpRequest.responseXML

      Call Log.Message("See the response XML in the Additional Information pane", responseXML.xml)

      Set Response = ServiceInfo.ParseInfo("createHomeGPRSIP", ResponseXML)

      Call Log.Message("Entity ID: " & Response.code)

      





    End Function




    Regards,

    Praveen
  • aqAnt's avatar
    aqAnt
    SmartBear Alumni (Retired)

    Hello Praveen,


    As far as I know, our Support Team is working with you on this query via e-mail.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi,



    I will appreciate if the summary is posted here when the case is closed...