Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing the request object within a web service? 1

Status
Not open for further replies.

millerk

Programmer
Jul 5, 2002
133
US
I'm new to web services, but I've got a basic web service with one web method working. With a regular aspx page, you have access to the Request object and can read whatever you need from it. Is there an equivalent to this for web services? I'd like to be able to access the soap request from within my web method.

Thanks
 
hi,

this should help:

<WebMethod()> _
Public Function HelloWorld(ByVal theVal As String) As String
Dim myStream As Stream
myStream = HttpContext.Current.Request.InputStream
Dim myStreamReader As New StreamReader(myStream)
myStream.Position = 0
Return myStreamReader.ReadToEnd
End Function

that returns the entire XML for me...

Known is handfull, Unknown is worldfull
 
welcome...

Known is handfull, Unknown is worldfull
 
This may be obvious to some, but in case anyone else tries this, one thing that threw me off at first is that if you are testing this by navigating directly to the .asmx page (or clicking start in VS), then the Request will be empty. So when I first tried it, I thought it wasn't working. But when I used my test page that calls the web service, it works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top