R
Ryan McConnell
I intend having a program which can load the details of a remote web
service and call it and process the relevant retured value.
I'm not sure how to go about that.
One method i have been using to some success, was to call a web service
based on the local machine, as a http request for a specific method in
the web service.
eg.
' Setup the WebRequest instance
'eg(http://localhost/service1.asmx/service
req = WebRequest.Create(startaddress)
' Use POST since we' re sending data (/service)
req.Method = "POST"
'Call the service and finally close out connection
Dim sw As New StreamWriter(req.GetRequestStream())
sw.Close()
'get incoming response
rsp = req.GetResponse()
' Wrap the response stream with a text-based reader
Dim sr As New StreamReader(rsp.GetResponseStream())
'Read all the response to a string, which we will convet to xml
newxml = sr.ReadToEnd
newXdoc.LoadXml(newxml)
However this method above doesnt work for services on a machine other
than the local machine.
Any advice?
Thanks
ryan mcconnell
service and call it and process the relevant retured value.
I'm not sure how to go about that.
One method i have been using to some success, was to call a web service
based on the local machine, as a http request for a specific method in
the web service.
eg.
' Setup the WebRequest instance
'eg(http://localhost/service1.asmx/service
req = WebRequest.Create(startaddress)
' Use POST since we' re sending data (/service)
req.Method = "POST"
'Call the service and finally close out connection
Dim sw As New StreamWriter(req.GetRequestStream())
sw.Close()
'get incoming response
rsp = req.GetResponse()
' Wrap the response stream with a text-based reader
Dim sr As New StreamReader(rsp.GetResponseStream())
'Read all the response to a string, which we will convet to xml
newxml = sr.ReadToEnd
newXdoc.LoadXml(newxml)
However this method above doesnt work for services on a machine other
than the local machine.
Any advice?
Thanks
ryan mcconnell