51Testing软件测试论坛

标题: 关于webserveice测试 [打印本页]

作者: wonder80    时间: 2006-3-21 15:51
标题: 关于webserveice测试
第一次使用webservices协议,测试可执行程序,开始录制后,exe程序不能被启动。
怎么才能正常启动程序呢?

在线等。急!
作者: 笑游天涯侠    时间: 2006-3-21 16:26
你是选择的“Record Client Application”吗?选择“Scan WSDL file”方式,试试

[ 本帖最后由 笑游天涯侠 于 2006-3-21 16:31 编辑 ]
作者: wonder80    时间: 2006-3-21 17:59
两个选项都试过了。都不能启动exe程序。
作者: wonder80    时间: 2006-3-22 13:13
选择“scan wsdl file”选项,生成脚本。运行的时候log 如下:

Virtual User Script started
Starting action vuser_init.
vuser_init.c(4): web_service_call "searchSales_101" started.
vuser_init.c(4): using client emulation General
vuser_init.c(4): web headers not matching emulated client removed.
vuser_init.c(4): Error: server returned an incorrectly formatted SOAP response
vuser_init.c(4): Error: web_service_call "searchSales_101" execution failed
Abort was called from an action.


请问是哪里出了问题? 请大家帮忙看看!

[ 本帖最后由 wonder80 于 2006-3-22 13:52 编辑 ]
作者: 笑游天涯侠    时间: 2006-3-22 14:08
web_service_call 调用"searchSales_101"时,有这个错误提示"web headers not matching emulated client removed.",检查一下是什么原因。
最好自己写整个测试脚本。
作者: wonder80    时间: 2006-3-22 17:10
我看可很多遍,都没有找出问题,以下是我的wsdl文件,能帮忙看看么?

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://192.168.0.147:7001/ticketWEB/services/Ticket" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://192.168.0.147:7001/ticketWEB/services/Ticket" xmlns:intf="http://192.168.0.147:7001/ticketWEB/services/Ticket" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="Ticket" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)-->
<wsdl:types>
  <schema targetNamespace="Ticket" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://192.168.0.147:7001/ticketWEB/services/Ticket"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="SearchSalesForm">
    <sequence>
     <element name="ev_event_name" nillable="true" type="soapenc:string"/>
     <element name="pe_time" nillable="true" type="soapenc:string"/>
     <element name="sa_p_code" nillable="true" type="soapenc:string"/>
     <element name="sa_start_time" nillable="true" type="soapenc:string"/>
     <element name="ve_region_name" nillable="true" type="soapenc:string"/>
     <element name="ve_venue_code" nillable="true" type="soapenc:string"/>
     <element name="ve_venue_name" nillable="true" type="soapenc:string"/>
    </sequence>
   </complexType>
   <complexType name="SearchSalesView">
    <sequence>
     <element name="pe_perf_name" nillable="true" type="soapenc:string"/>
     <element name="pe_time" nillable="true" type="soapenc:string"/>
     <element name="sa_p_code" nillable="true" type="soapenc:string"/>
     <element name="sa_status" nillable="true" type="soapenc:string"/>
     <element name="se_member_discnt_f" nillable="true" type="soapenc:string"/>
     <element name="se_price" nillable="true" type="soapenc:string"/>
     <element name="se_seat_sale_type" nillable="true" type="soapenc:string"/>
     <element name="se_seat_type" nillable="true" type="soapenc:string"/>
     <element name="ve_venue_name" nillable="true" type="soapenc:string"/>
    </sequence>
   </complexType>
  </schema>
  <schema targetNamespace="http://192.168.0.147:7001/ticketWEB/services/Ticket" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="Ticket"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_tns1_SearchSalesView">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:SearchSalesView[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
</wsdl:types>

   <wsdl:message name="searchSalesResponse">

      <wsdl:part name="searchSalesReturn" type="impl:ArrayOf_tns1_SearchSalesView"/>

   </wsdl:message>

   <wsdl:message name="searchSalesRequest">

      <wsdl:part name="searchSalesForm" type="tns1:SearchSalesForm"/>

   </wsdl:message>

   <wsdl:portType name="TicketService">

      <wsdl:operation name="searchSales" parameterOrder="searchSalesForm">

         <wsdl:input message="impl:searchSalesRequest" name="searchSalesRequest"/>

         <wsdl:output message="impl:searchSalesResponse" name="searchSalesResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="TicketSoapBinding" type="impl:TicketService">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="searchSales">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="searchSalesRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.0.147:7001/ticketWEB/services/Ticket" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="searchSalesResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.0.147:7001/ticketWEB/services/Ticket" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TicketServiceService">

      <wsdl:port binding="impl:TicketSoapBinding" name="Ticket">

         <wsdlsoap:address location="http://192.168.0.147:7001/ticketWEB/services/Ticket"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>




以下是我的lr脚本:

vuser_init()
{

        web_service_call( "StepName=searchSales_102",
                "SOAPMethod=TicketServiceService.TicketService.searchSales",
                "ResponseParam=response",
                "WSDL=D:/Work/PIA/exe/test.wsdl",
                "Snapshot=t1143015847.inf",
                BEGIN_ARGUMENTS,
                "xml:searchSalesForm=<searchSalesForm><ev_event_name></ev_event_name><pe_time>"
                                "</pe_time><sa_p_code></sa_p_code><sa_start_time></sa_start_time><ve_region_name>"
                                "</ve_region_name><ve_venue_code></ve_venue_code><ve_venue_name></ve_venue_name>"
                                "</searchSalesForm>",
                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);

        lr_think_time(3);



        return 0;
}


请各位帮忙看看!
作者: 笑游天涯侠    时间: 2006-3-22 18:44
你脚本中都没有指定参数值,是不是有些参数必须要指定输入值呀?
作者: wonder80    时间: 2006-3-23 09:57
这是测试一个检索功能。不输入检索条件试,是无条件检索,检索出所有的数据。

[ 本帖最后由 wonder80 于 2006-3-23 09:59 编辑 ]
作者: 笑游天涯侠    时间: 2006-3-23 10:18
如果你用的是lr8.0,最好先打上lr8.0的web services的补丁。
你在run-time settings里的log,选择extended log,包括其下的每一项,再回放,看看错误的具体原因。
如果实在还搞不定,那就直接写http脚本,因为web services call只是一种特殊的http请求。具体该怎么写脚本,你可以参考我在论坛发表的“lr下web services测试总结二”
作者: wonder80    时间: 2006-3-23 17:37
研究了一下午的soap请求,然后根据我的wsdl(前面贴的),写了个soap请求。不知道是否正确。能帮忙看看么?

<soap:Envelope   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance/"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema/">
         
         <soap:Body>  
            <searchSales xmlns="TicketServiceService.TicketService">
               ev_event_name=
               pe_time=
              sa_p_code=
              sa_start_time=
              ve_region_name=
              ve_venue_code
              ve_venue_name="  
            </searchSales>
         </soap:Body>
</soap:Envelope>


另外,soap请求中需要通过soap:Header追加TransactionID么?这个值有是怎么取得呢?
作者: wonder80    时间: 2006-3-24 14:02
大家帮忙看看吧  先谢谢了
作者: 笑游天涯侠    时间: 2006-3-24 14:50
嗨,你这个根本就不需要soap:Header,这个东东是根据你的格式文件来的。
给你一个最简单的例子:
Action()
{
char soapBody[1024] = "SOAPEnvelope=<soap:Envelope  xmlns:soap="
     "\"http://schemas.xmlsoap.org/soap/envelope/\"\n  xmlns:xsi="
     "\"http://www.w3.org/2001/XMLSchema-instance\"\n  xmlns:xsd="
     "\"http://www.w3.org/2001/XMLSchema\">"
     "\n<soap:Body>"  
     "\n<test xmlns=\"http://www.monternet.com/dsmp/schemas/\">"
     "\n<a>19</a>"
     "\n</test>"
     "\n </soap:Body>"
     "\n</soap:Envelope>";

   
     web_add_header("SOAPAction","http://www.monternet.com/dsmp/schemas/test");

     soap_request("StepName=OrderReq",
     "URL=http://test1/wapprovision/provision.asmx",
     soapBody,
    "Snapshot=t1.inf",
    "ResponseParam=result",
    LAST);


        return 0;
}
作者: wonder80    时间: 2006-3-28 11:34
能不能把你例子中用的格式文件wsdl文件 给我看看啊。
因为对于如何取url,test 这些变量的值,不是很清楚!sdlkfj想仔细了解一下。
先谢了sdlkfj

[ 本帖最后由 wonder80 于 2006-3-28 11:41 编辑 ]
作者: 笑游天涯侠    时间: 2006-3-28 14:59
你的wsdl文件是你写的吗?
<wsdlsoap:operation soapAction=""/>这句感觉有点问题呀,
你的soapAction为空?
并把所有的<wsdlsoap:换成<soap:
然后试试。
作者: whcgy    时间: 2006-5-18 17:35
“lr下web services测试总结二” 中Web Services的HTTP请求脚本开发中的url具体指的是什么啊
作者: juju5288    时间: 2006-5-18 22:01
我之前做webserveice测试是用loadrunner调用XMLSPY进行的。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2