Forum Discussion

heath_howe's avatar
heath_howe
Occasional Contributor
9 years ago
Solved

web service parameter value changed

I am using TestComplete to access a very simple internal web service that feeds data to a SQL database. When I do this in TestComplete, the string RecordData is stored in the database with the delimiter (¶) is converted to "??" . The very same data passed to the same web service in SoapUI stores the RecordData delimiters correctly in the database. Perhaps there is a setting in TestComplete that I am missing. The "Units encoding" setting of the project has no effect.

 

[JScript]

var RecID;

Project.Variables.RecordType = "StopUpdate";
Project.Variables.RecordData = "tripID=0¶RunID=100¶StopID=48000501";
RecID = WebServices.DispatchInterface.SendToMDT2(Project.Variables.RecordType, Project.Variables.RecordData);

 

Thanks for any thoughts or suggestions on how to address this.

  • heath_howe's avatar
    heath_howe
    9 years ago

    I've done little to troubleshoot this matter, but ran across the jscript implementation of webservice calls and that's the workaround I've pursued. For anyone else interested, here is the function (indentation notwithstanding) as it is working for me:

    function CallWS(wsURL, wsRequest, wsMethod)
    {
    var xmlResponse;
    var xmlResult;
    var XmlHttpRequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");

    XmlHttpRequest.open("POST", wsURL, false);
    XmlHttpRequest.setRequestHeader("Content-type", "text/xml; charset=utf-8");
    XmlHttpRequest.setRequestHeader("SOAPAction", "http://tempuri.org/" + wsMethod);
    XmlHttpRequest.send(wsRequest);

    xmlResponse = XmlHttpRequest.responseXML;
    xmlResult = xmlResponse.text;
    if (xmlResult == "")
    {
    xmlResult = xmlResponse.xml;
    }
    return xmlResult;
    }

     

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Heath,

     

    This symbol is a custom symbol (character code) used in MS Word (and, maybe, other programs) to indicate the end of the paragraph. (And another symbols are used to indicate the hard end of line, end of table cell, etc.)

    So you must replace this symbol to the one(s) that is/are expected by your application. Most probably, SoapUI (or its data editor) replaces this character with the CR/LF pair. You can easily check this in SoapUI examining actual request data after the request is executed.

    Just in case: codes for the CR/LF pair are chr(13) and chr(10)

    • heath_howe's avatar
      heath_howe
      Occasional Contributor

      Thanks, Alex. I appreciate the response, and it may be that TestComplete is replacing that character with CR/LF but I don't understand why it would. I am passing a string (in quotes) that includes this character, which is simply ANSI char 182. Being within my quoted string, I don't understand why it would be "messed with" by TestComplete. What SoapUI passes through is exactly what I pass in my string, other text along with two occurrences of character 182. As noted, TestComplete replaces both occurrences of that character within the string with "??".

       

      I would really prefer to use TestComplete for this purpose (a very small part of an extensive winform test). Any thoughts on a workaround within TestComplete? 

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi Heath,

         

        > [...] TestComplete is replacing that character with CR/LF but I don't understand why it would.

        What I would do (if I got you right) is to use Fiddler or the similair tool to record the traffic send by SoapUI and TestComplete and check (maybe even in hex mode to see the actual codes of the sent symbols) what was send actually to the web service. Then, based on the comparison results I would make a decision what and where should be corrected.

        Does it make sense?