Forum Discussion

shivashish's avatar
shivashish
Occasional Contributor
13 years ago

Creating a SOAP request for webservices testing through script

Hi,



I want to create a soap request as shown below. As you can see from the code below, the method Request1RQ takes an object as in input parameter and then provides the response back. I am creating a SOAP request through TC as shown in the link (http://support.smartbear.com/viewarticle/18902/). However , i am not able to pass the values(CFU) into the parameter HotelCityCode. The parameter can be accessed by the following line

TypeFactory.HotelSearchCriterionType.HotelRef.HotelCityCode = "CFU"



My question is, how can i Specify the values for the HotelCityCode method through TestComplete code? Can someone please help me with this? I feel that it has a very simple solution , but for some reason i am not able to get this working inspite of trying this for the past two days:(

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

    <soap:Header>

     <authentication xmlns="http://xmlota.wspan.com/webservice/">

      <userid>userone</userid>

      <password>nicole1</password>

     </authentication>

    </soap:Header>

    <soap:Body>

     <Request1RQ xmlns="http://XXXXXXXX/2003/05" Version="1">

      <AvailRequestSegments>

                <AvailRequestSegment>

                        <StayDateRange Start="2012-08-14" End="2012-08-21"/>

                   <RoomStayCandidates>

                    <RoomStayCandidate>

                                    <GuestCounts>

                        <GuestCount Count="2" AgeQualifyingCode="10"/>

                    </GuestCounts>

                        </RoomStayCandidate>

                </RoomStayCandidates>

                <HotelSearchCriteria>

                        <Criterion>

                                    <HotelRef HotelCityCode="CFU"/>

                        </Criterion>

                </HotelSearchCriteria>

                </AvailRequestSegment>

      </AvailRequestSegments>

     </OTA_HotelAvailRQ>

    </soap:Body>

   </soap:Envelope>



2 Replies

  • shivashish's avatar
    shivashish
    Occasional Contributor
    Hi,



    Can someone please provide me some direction with this?



    Thanks,

    Shiv

  • Hello Shiv,





    If your web service method accepts an object as a parameter, the best way to get the proper code for the object creation is to go to the Web Service editor, find the needed object type under the Types node, select the type, and click the Code button to the right of the type name. This will give you a correct version of the code required to create an object of this type.





    Does this help?





    If it does not, post the code you are getting, and describe what the problem is with that code. Thanks!