web services - reading and displaying a webservice output in classic asp -
i reading webservice output classic asp.
web service output follows.
<boolean xmlns="http://somewebsite.com/">true</boolean>
this proper output expected.
i have written below code read output in classic asp.
set obj1 = server.createobject("msxml2.serverxmlhttp.3.0") url1 = "http://webserive.asmx/method?para=2" obj1.open "get", url1, false obj1.setrequestheader "content-type", "application/x-www-form-urlencoded; charset=utf-8" obj1.setrequestheader "soapaction", url1 obj1.send if obj1.responsetext <> "" response.write "ok." & obj1.responsetext end if
but output prints following output:
"ok. true"
there space in output not expected.
this problem.
please advice.
so think may have miss understood require. if want parse xml remove content of;
<boolean xmlns="http://somewebsite.com/">true</boolean>
is returned browser in case true
need parse xml using xpath underlying value.
'after initial send() dim xml, root if obj1.status = 200 set xml = obj1.responsexml call xml.setproperty("selectionlanguage", "xpath") set root = xml.documentelement call response.write(root.selectsinglenode("boolean").text) end if
Comments
Post a Comment