如何获得webservice response中的某个值
Action(){
web_add_auto_header("Accept-Encoding", "gzip");
web_add_auto_header("SOAPAction", "\"\"");
web_add_auto_header("User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)");
web_add_header("Content-Type", "text/xml; charset=utf-8");
soap_request("StepName=sysGetZTXX",
"URL=http://192.168.10.240/sdrp/PublicWebServiceInterface",
"SOAPEnvelope=<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"no\"?"
"><soap:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns"
":xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soap=\"http:/"
"/schemas.xmlsoap.org/soap/envelope/\"><soap:Body><sysGetZTXX xmlns=\""
"http://service.commons.hoperun.com/\"><arg0 xmlns=\"\">{\"USERID\":\""
"21130720000\",\"XM\":null,\"PASSW\":\"\",\"ZTXXID\":\"\",\"ZTNAME\""
":null,\"SESSIONID\":null,\"MACADDRESS\":null,\"WLDWXIID\":null,\""
"WLDWBH\":null,\"WLDWMC\":null,\"MENU_INFO\":[],\"KFXXID\":null,\"KFBH"
"\":null,\"KFMC\":null,\"KWXXID\":null,\"KWBH\":null,\"KWMC\":null,\""
"SUCCESS\":false,\"QYID\":null,\"QYBH\":null,\"QYMC\":null,\"DH\":null,"
"\"XXDZ\":null,\"SYSDATE\":null,\"MDXS\":null,\"DZMM\":null,\""
"CDSCJ_INFO\":[],\"DZBJ\":null,\"DBRXM\":null,\"SYFS\":null}</arg0></"
"sysGetZTXX></soap:Body></soap:Envelope>",
"Snapshot=t1.inf",
"ResponseParam=response",
LAST);
return 0;
}
其中userid=21130720000为登陆的用户id,以下为respone返回的结果,请问如何获得ZTXXID的值,谢谢。 <?xml version="1.0" ?>
- <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
- <S:Body>
- <ns2:sysGetZTXXResponse xmlns:ns2="http://service.commons.hoperun.com/">
<return>{"ZTXXS":[{"ZTNAME":"苏州六店","ZTXXID":"2113072"}]}</return>
</ns2:sysGetZTXXResponse>
</S:Body>
</S:Envelope> 要沉了,请高手给个指点~~:) 用了好多方法,都取不到值,我需要取到ZTXXID的值,作为后面请求的参数。 我的入参是在一起的,如:<arg0 xmlns=\"\">{\"USERID\":\"21130720000\",\"XM\":null,\"PASSW\":\"\",\"ZTXXID\":\"\",\"ZTNAME\":null,\"SESSIONID\":null,\"MACADDRESS\":null,\"WLDWXIID\":null,\"WLDWBH\":null,\"WLDWMC\":null,\"MENU_INFO\":[],\"KFXXID\":null,\"KFBH\":null,\"KFMC\":null,\"KWXXID\":null,\"KWBH\":null,\"KWMC\":null,\"SUCCESS\":false,\"QYID\":null,\"QYBH\":null,\"QYMC\":null,\"DH\":null,\"XXDZ\":null,\"SYSDATE\":null,\"MDXS\":null,\"DZMM\":null,\"CDSCJ_INFO\":[],\"DZBJ\":null,\"DBRXM\":null,\"SYFS\":null}</arg0>"
返回的结果为:{"ZTXXS":[{"ZTNAME":"苏州六店","ZTXXID":"2113072"}]}
请问如何截取到相应的值。 使用web_reg_save_param不能获取到嘛? 用lr_xml_get_values()函数试试
页:
[1]