Forum Discussion

nwang66's avatar
nwang66
Contributor
15 years ago

WebService: how to assign value to parameter

Hi,



   I am testing a web service. Please see attached screen shot. The following is my code. Here "CSISServeWS" is the name of the web service. MarketParticipantIdentifier is one of the parameters and mandatory. After running the script, I got "search failed with exception that MarketParticipantIdentifier is invalid". It seems the value of "ATCO" was not passed in. I tried single quotation market or '\', no one works... Can you please let me know where I am wrong?



   Thanks in advance.



Nancy

 

   var typeFactory = WebServices.CSISServeWS.TypeFactory;

   typeFactory.SiteIDLookupInParam.MarketParticipantIdentifier = "ATCO";

   typeFactory.SiteIDLookupInParam.SiteID = "010999865277";

   //following command doesn't return anything.

   Log.Message(typeFactory.SiteIDLookupInParam.MarketParticipantIdentifier);

   var tmp = WebServices.CSISServeWS.GetSiteIDLookupResult(typeFactory.SiteIDLookupInParam);

   Log.Message(tmp.Message);

1 Reply

  • ... figured out this ... would like to share, and welcome any inputs. Since the input parameter type of my web service is an object, SisteIDLookupInParam. So I have to create this object first and then assign values to its properties. TestComplete WebService Test editor has a button 'Code', which can be used to generate the code for creating the object. The followings are my code.


    function Main()

    {

       var myPara = new SiteIDLookupInParam();

       myPara.MarketParticipantIdentifier = "ATCO";

       myPara.CityName = "MUNDARE";

      

       var result = new SiteIDLookupResult();

       var result = WebServices.CSISServeWS.GetSiteIDLookupResult(myPara);

       Log.Message(result.Message);

       ...

    }


    //the following is copied from Code generation button

    function SiteIDLookupInParam()

    {

      var  Result;

      var  TypeFactory;

      //Get the type factory for the web service

      TypeFactory = WebServices.CSISServeWS.TypeFactory;

      Result = TypeFactory.SiteIDLookupInParam;

      return Result;

    }