Forum Discussion

rrubio's avatar
rrubio
Contributor
14 years ago

unable to pass an input parameter to a Web Service (object : array of strings)

Hi all,



I need to pass to a web service an input parameter whose type is Object, made of a array of strings.

TestComplete detects it when the webservice has been defined. However I am not able to success in the call to this webservice method.



I have attached the webservice definition as in TestComplete (file: webservicedefinition.jpg)



In my script I have this:





    myobject=CreateVariantArray2(0,1)

    myobject(0)="ORDCON_G"

    

    Call WebServices.screen.GetList(Project.Variables.idSesion, -1, myobject, null, -1, null, listaXML)



It does return the following error:



SOAP-ENV:Client
Badly formed SOAP Message
ERROR #6254: Tag expected, XML input, ORDCON_G, is not in proper format as child of pobjScreenCodeList (ending at line 2 character 330).
Unit: "tmpRaul" Line: 24 Column: 5.<SOAP-ENV:Fault
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

 <faultcode>SOAP-ENV:Client</faultcode>

 <faultstring>Badly
formed SOAP Message</faultstring>

 <detail>

  <error
xmlns="http://tempuri.org">

   <text>ERROR #6254: Tag expected, XML
input, ORDCON_G, is not in proper format as child of pobjScreenCodeList (ending
at line 2 character 330).</text>

 
</error>

 </detail>

</SOAP-ENV:Fault>

Unit: "tmpRaul"
Line: 24 Column: 5.



---------------------



could anybody explain how could I pass an array of strings?

the problem could be I am passing an array of variants and this is not understood by the server?



Regards,



Raul

6 Replies

  • Hello Raul,



    According to the screen shot, you are expected to generate the parameter value in this way:

    Set TypeFactory = WebServices.screen.TypeFactory 

    Set CodeListItems = TypeFactory.ArrayOfpobjScreenCodeListItemString 

    Set CodeListItems.pobjScreenCodeListItem = BuiltIn.CreateVariantArray(0, 0) 

    CodeListItems.pobjScreenCodeListItem(0) = "ORDCON_G"



    Call WebServices.screen.GetList(Project.Variables.idSesion, -1, CodeListItems, null, -1, null, listaXML)


    Does this work?
  • Hi Alex,

    I have tested what you suggest and I have an error in following line:



      Set CodeListItems.pobjScreenCodeListItem = Builtin.CreateVariantArray(0, 0)



    Error message is:



    An exception occurred in the "tmp_raul" unit at line 12:
    Error de Microsoft VBScript en tiempo de ejecución
    Se requiere un objeto: 'CodeListItems.pobjScreenCodeListItem'An exception occurred in the "tmp_raul" unit at line 12:

    Error de Microsoft
    VBScript en tiempo de ejecución

    Se requiere un objeto:
    'CodeListItems.pobjScreenCodeListItem'





    I think the problem is that I am assigning an Array of Variants to an Array of Strings.

    I have tried:

      Set CodeListItems.pobjScreenCodeListItem = aqConvert.VarToStr(Builtin.CreateVariantArray(0, 0))

    and obviously it has not worked.



    Do you have any idea of what could I do?



    Thanks in advance,



    Raul


  • Hi ,



    I am also working with webservices and passing array as input parameters.



    Plz see the sanpshot, When i pass value to the array it is not visible in the watch list while debugging.



    Why so happening, Am i using the  the write approach to work with array of objects.



    Thanks and Regards

    Paramveer

  • Hi Paramveer,





    Thanks for reporting the issue. We have found its cause, and we will fix the problem in a future TestComplete version.





    To see the values during debugging, right-click the "To" element in the Watch List panel, and select "Inspect..." - you will see the properties, and their values.