incool 发表于 2007-6-1 10:46:55

测试WebService时如果传递SoapHeader

在LoadRunner8.0里有这个选项:
使用了下面的XML
<?xml version="1.0" encoding="utf-8"?>
<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:Header>
<SoapHeader xmlns="http://tempuri.org/">
<strUserID>Test</strUserID>
<strPWD>123</strPWD>
<strSessionNo>0000B</strSessionNo>
</SoapHeader>
</soap:Header>
</soap:Envelope>

运行后脚本是通过的,但没有数据返回,有警告错误

Starting action vuser_init.
vuser_init.c(4): web_service_call "GetAnaesthesiaList_101" started.
vuser_init.c(4): Using working copy of the WSDL file "http://127.0.0.1:8080/WebService.asmx?wsdl"
vuser_init.c(4): Using client emulation General
vuser_init.c(4): Web headers not matching emulated client removed.
vuser_init.c(4): Warning: HTTP status code 400 returned by server
vuser_init.c(4): There was a warning during web_service_call "GetAnaesthesiaList_101"
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.


不知道是不是因这SoapHeader传递的不对还是什么原因?

[ 本帖最后由 incool 于 2007-6-1 10:48 编辑 ]

incool 发表于 2007-6-1 13:10:39

顶一下,这么快就沉了,有没有人晓得哇

net_rong 发表于 2007-7-13 11:59:53

见新贴“只要在use soap header下加入几行认证xml语句”

脚本中显示如下
"SOAPHeader=<soap:Header>    <CredentialSoapHeader xmlns=\"http://tempuri.org/\""
                              ">      <UserName>user</UserName>      <PassWord>password</PassWord>    "
                              "</CredentialSoapHeader></soap:Header>",

sunkitty 发表于 2008-1-27 15:46:56

学习中!

sailing_99 发表于 2008-3-29 16:08:57

vuser_init()
{

        web_service_call( "StepName=CustInfoQuery_102",
                "SOAPMethod=CustInfoQueryPTExport1_CustInfoQueryPTHttpService.CustInfoQueryPT.CustInfoQuery",
                "ResponseParam=response",
                "WSDL=D:/wsdl/CustInfoQueryPTExport1_CustInfoQueryPTHttp_Service.wsdl",
                "UseWSDLCopy=1",
                "Snapshot=t1206776860.inf",
                BEGIN_ARGUMENTS,
                "Version=66",
                "CustomerSell=600101",
                "xml:QueryCondition=<QueryCondition><QueryColName>CustomerName</QueryColName>"
                                "<QueryColValue>99</QueryColValue></QueryCondition>",
                "QueryType=1",
                "MsgSender=600101",
                "MsgReceiver=10",
                END_ARGUMENTS,
                BEGIN_RESULT,
                END_RESULT,
                LAST);

        lr_think_time(3);



        return 0;
}

----------------------------------
虚拟用户脚本已启动
正在开始操作 vuser_init。
vuser_init.c(4): Web service call "CustInfoQuery_102" started
vuser_init.c(4): Using working copy of the WSDL file "D:/wsdl/CustInfoQueryPTExport1_CustInfoQueryPTHttp_Service.wsdl"
vuser_init.c(4): Using client emulation General
vuser_init.c(4): Removed Web headers not matching the emulated client
vuser_init.c(4): 错误: C interpreter run time error: vuser_init.c (4):Error -- memory violation : Exception ACCESS_VIOLATION received.
vuser_init.c(4):
通知: CCI 跟踪: vuser_init.c(4): web_service_call(0x011f035c "StepName=CustInfoQuery_102", 0x011f0301 "SOAPMethod=CustInfoQueryPTExport1_CustIn...", 0x011f02ea "ResponseParam=response", 0x011f02a5 "WSDL=D:/wsdl/CustInfoQueryPTExport1_Cust...", 0x011f0297 "UseWSDLCopy=1", 0x011f027e.
vuser_init.c(4):
通知: CCI 跟踪:"Snapshot=t1206776860.inf", 0x011f026e "BEGIN_ARGUMENTS", 0x011f0263 "Version=66", 0x011f024f "CustomerSell=600101", 0x011f01d0 "xml:QueryCondition=<QueryCondition><Quer...", 0x011f01c4 "QueryType=1", 0x011f01b3 "MsgSender=600101", 0x011f01a4 "MsgReceiver=.
vuser_init.c(4):
通知: CCI 跟踪: 10", 0x011f0196 "END_ARGUMENTS", 0x011f0189 "BEGIN_RESULT", 0x011f017e "END_RESULT", 18809209)
.
vuser_init.c(4): 通知: CCI 跟踪: Compiled_code(0): vuser_init()
.

帮忙看一下

cocayang 发表于 2011-6-19 20:15:18

不是太懂
页: [1]
查看完整版本: 测试WebService时如果传递SoapHeader