本人用vb.net写的一个webservice,通过网页访问,显示如下信息
POST /webservice/webservice1.asmx HTTP/1.1
Host: 192.168.168.101
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”>
<soap12:Body>
<GetUserInfoByUserName xmlns=”http://tempuri.org/”>
<name>string</name>
<pwd>string</pwd>
</GetUserInfoByUserName>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”>
<soap12:Body>
<GetUserInfoByUserNameResponse xmlns=”http://tempuri.org/”>
<GetUserInfoByUserNameResult>
<xsd:schema>schema</xsd:schema>xml</GetUserInfoByUserNameResult>
</GetUserInfoByUserNameResponse>
</soap12:Body>
</soap12:Envelope>
这里返回的是<xsd:schema>schema</xsd:schema>xml</GetUserInfoByUserNameResult>,本人用android的pull解析,问一下当程序找到<GetUserInfoByUserNameResult>后下面的 <xsd:schema>schema</xsd:schema>xml</GetUserInfoByUserNameResult>该怎么样解析,android程序用return pullParser.nextText();返回Unexpected event Type:START_TAG
POST /webservice/webservice1.asmx HTTP/1.1
Host: 192.168.168.101
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”>
<soap12:Body>
<GetUserInfoByUserName xmlns=”http://tempuri.org/”>
<name>string</name>
<pwd>string</pwd>
</GetUserInfoByUserName>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”>
<soap12:Body>
<GetUserInfoByUserNameResponse xmlns=”http://tempuri.org/”>
<GetUserInfoByUserNameResult>
<xsd:schema>schema</xsd:schema>xml</GetUserInfoByUserNameResult>
</GetUserInfoByUserNameResponse>
</soap12:Body>
</soap12:Envelope>
这里返回的是<xsd:schema>schema</xsd:schema>xml</GetUserInfoByUserNameResult>,本人用android的pull解析,问一下当程序找到<GetUserInfoByUserNameResult>后下面的 <xsd:schema>schema</xsd:schema>xml</GetUserInfoByUserNameResult>该怎么样解析,android程序用return pullParser.nextText();返回Unexpected event Type:START_TAG
解决方案
25
webservice在android上的处理建议用ksoap2库来处理
15
https://code.google.com/p/ksoap2-android/wiki/HowToUse?tm=2