Forum Discussion

jbuchanan's avatar
jbuchanan
New Contributor
13 years ago

Add SOAP Header only and still use WebService object

I've tried the examples from the help files on adding a soap:header and then using XmlHttpRequest to "POST" with no success.  I would just like to use the normal WebService.WebService1.MyMethod(param1) with a modified xml.  Any suggestions? 

thanks,

jody

6 Replies

  • Hi jody,



    I would just like to use the normal WebService.WebService1.MyMethod(param1) with a modified xml.

     

    Currently, there's no way to do this. We've got a suggestion to implement such functionality, and your post has increased its rating.






    I've tried the examples from the help files on adding a soap:header and then using XmlHttpRequest to "POST" with no success.

     

    If you described the problems more specifically and sent us some images demonstrating them, we could give you a piece of advice.
  • jbuchanan's avatar
    jbuchanan
    New Contributor
    Thanks for the reply, it will be a great feature to have in TestComplete.  In the meantime, i finally got my script working as follows:



    webserver.open("POST", "http://localhost/Services/DataIntegrationService.svc", false);



    // Had to add the following 2 lines in order to make a successul WS call after adding a custom element to the SOAP Header

    // I found this solution by various searches and examples; not 100% sure why I had to do this, but it works and eliminated error messages

    webserver.setRequestHeader("Content-type", "text/xml; charset=utf-8");    

    webserver.setRequestHeader("SOAPAction", "WebService.DataIntegration/DataIntegrationService/UpdateData");  





    webserver.send(RequestXml.xml);
  • Hi jody,



    I am also searching solution of above problem.



    I copied above code in one function, but it not complying . showing syntaxerror.



    Please suggest.


    webserver.open("POST", "https://devtest.idigi.com/mobile/services/DeviceManagementService.DeviceManagementServiceHttpSoap11Endpoint/", false);


    webserver.setRequestHeader("Content-type", "text/xml; charset=utf-8");


    webserver.setRequestHeader("username", "Admin");


    webserver.setRequestHeader("password", "password");


    webserver.setRequestHeader("portalId", "10.10.10.10");


    webserver.send(RequestXml.



     



    xml);