51Testing软件测试论坛

标题: 用web_custom_request协议发送soap报文的问题 [打印本页]

作者: ferri    时间: 2013-8-20 18:33
标题: 用web_custom_request协议发送soap报文的问题
各位大家好,我有个项目,需要用编写脚本用soap协议,发送报文到服务器,我分别用soap_request函数和web_custom_request函数发送报文,soap_request可以发送,但是web_custom_request不行,而soap_request虽然能发送但是返回的报文不好解析,原来用 lr_xml_get_values函数解析,后来看到说这个函数的性能很低,所以想换web_custom_request发送,用web_reg_save_param来解析。但是不成功,现在把代码贴出来各位帮忙看看:
soap_request发送:
soap_request("StepName=SOAP Request",                                                                                
                "URL=http://192.16.21.178:7811/SelfHelp/AgentServer",                                                                                
                "SOAPEnvelope="
                "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"ns:fwbs\">"
                        "<soapenv:Header></soapenv:Header>"
                        "<soapenv:Body>"
                                "<ns:agentPay>"
                                        "<feetype>13</feetype>"
                                        "<tlrno>0394</tlrno>"
                                        "<custno>45113904</custno>"
                                        "<hbrno>10004</hbrno>"
                                        "<channel>selfHelp</channel>"
                                        "<qfbs>1</qfbs>"
                                        "<txamt>702.00</txamt>"
                                        "<cashflg>1</cashflg>"
                                        "<actno>6223920001101146592</actno>"
                                        "<NotCheckPasswd>1</NotCheckPasswd>"
                                        "<TXTYPE>0</TXTYPE>"
                                        "<passwd></passwd>"
                                "</ns:agentPay>"
                        "</soapenv:Body>"
                "</soapenv:Envelope>",                                                                                
                "SOAPAction=AgentServer",        
                "ExpectedResponse=AnySoap",
                "ResponseParam=result",                                                                                
                "Snapshot=t1376963486.inf",                                                                           
                LAST);

web_custom_request发送:

        web_add_header("Content-Type","text/xml; charset=utf-8");
        web_add_header("Accept","application/soap+xml, application/dime,multipart/related, text/*");
        web_add_header("Cache-Control","no-cache");
        web_add_header("Pragma","no-cache");
        web_add_header("SOAPAction","AgentServer");
   
        web_custom_request("AgentServer",
        "URL=http://192.16.21.178:7811/SelfHelp/AgentServer",
        "Method=POST",
        "Resource=0",
        "RecContentType=text/xml",
        "Mode=HTML",
        "EncType=text/xml; charset=utf-8",
        "Body=<?xml version=\"1.0\"encoding=\"UTF-8\" standalone=\"no\"?>"
        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"ns:fwbs\">"
                        "<soapenv:Header></soapenv:Header>"
                        "<soapenv:Body>"
                                "<ns:agentPay>"
                                        "<feetype>13</feetype>"
                                        "<tlrno>0394</tlrno>"
                                        "<custno>45113904</custno>"
                                        "<hbrno>10004</hbrno>"
                                        "<channel>selfHelp</channel>"
                                        "<qfbs>1</qfbs>"
                                        "<txamt>702.00</txamt>"
                                        "<cashflg>1</cashflg>"
                                        "<actno>6223920001101146592</actno>"
                                        "<NotCheckPasswd>1</NotCheckPasswd>"
                                        "<TXTYPE>0</TXTYPE>"
                                        "<passwd></passwd>"
                                "</ns:agentPay>"
                        "</soapenv:Body>"
                "</soapenv:Envelope>",
                LAST);
不成功,报错信息为:
Action.c(16): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://192.16.21.178:7811/SelfHelp/AgentServer"          [MsgId: MERR-26612]
Action.c(16): web_custom_request("AgentServer") highest severity level was "ERROR", 2658 body bytes, 181 header bytes          [MsgId: MMSG-26388]
怎么都解决不了,也加了web_api.h        
各位大大,帮忙看看
作者: goal1860    时间: 2013-8-21 13:01
如果是500错误,那多半还是发送的soap消息本身有错误。用soapui测试一下,确保消息本身正确。
作者: msnshow    时间: 2013-8-31 20:45
还是内容有问题




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