473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Determin How WebService method was invoked

Hi there,

Is it possible to tell how a WebMethod was invoked? For example I would
like to determin if it was invoked via SOAP or HTTP Post. Other than
creating 2 methods I am no sure if I can do this.

Many thanks for your time.

Nick.
Jun 27 '08 #1
7 1551
Nick wrote:
Is it possible to tell how a WebMethod was invoked? For example I would
like to determine if it was invoked via SOAP or HTTP Post.
I've no idea how to do this but I'm curious - why would need to know this?

Regards,
Phill W.
Jun 27 '08 #2
On Jun 17, 6:51 am, "Nick" <a...@a.comwrote:
Hi there,

Is it possible to tell how a WebMethod was invoked? For example I would
like to determin if it was invoked via SOAP or HTTP Post. Other than
creating 2 methods I am no sure if I can do this.

Many thanks for your time.

Nick.
Since its a web application, i would first try

HttpContext.Current.Request.HttpMethod
Jun 27 '08 #3
Hi Phil,

Well basically I'm creating an API that reacts differently depending how
it is invoked. For example, if invoked via SOAP within a client based
application I want to return some verbose XML data, but if invoked via HTTP
Post I would like to respond by redirecting to different URLS with limited
return value information. The idea behind this is that it won't mean that
the Post based calls won't have to parse loads of XML data.

That's the theory anyway.

Nick.

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:g3**********@south.jnrs.ja.net...
Nick wrote:
>Is it possible to tell how a WebMethod was invoked? For example I would
like to determine if it was invoked via SOAP or HTTP Post.

I've no idea how to do this but I'm curious - why would need to know this?

Regards,
Phill W.

Jun 27 '08 #4
Hi Parez,

Thanks for the help, unfortunately that only seems to return GET, POST
or HEAD, so SOAP requests return POST. Unfortunately I need to know if it's
a SOAP request.

Maybe I'm misunderstanding something which is quite possible...

Nick.

"parez" <ps*****@gmail.comwrote in message
news:2e**********************************@x41g2000 hsb.googlegroups.com...
On Jun 17, 6:51 am, "Nick" <a...@a.comwrote:
>Hi there,

Is it possible to tell how a WebMethod was invoked? For example I
would
like to determin if it was invoked via SOAP or HTTP Post. Other than
creating 2 methods I am no sure if I can do this.

Many thanks for your time.

Nick.

Since its a web application, i would first try

HttpContext.Current.Request.HttpMethod

Jun 27 '08 #5
Ahhaa got it...

If (Not
String.IsNullOrEmpty(HttpContext.Current.Request.H eaders.Item("SOAPAction")))
Then
'//It was a SOAP request
Else
'//It wasn't a SOAP request
End If

excellent, thanks for your time peeps.

"Nick" <a@a.comwrote in message
news:OA**************@TK2MSFTNGP05.phx.gbl...
Hi Parez,

Thanks for the help, unfortunately that only seems to return GET, POST
or HEAD, so SOAP requests return POST. Unfortunately I need to know if
it's a SOAP request.

Maybe I'm misunderstanding something which is quite possible...

Nick.

"parez" <ps*****@gmail.comwrote in message
news:2e**********************************@x41g2000 hsb.googlegroups.com...
>On Jun 17, 6:51 am, "Nick" <a...@a.comwrote:
>>Hi there,

Is it possible to tell how a WebMethod was invoked? For example I
would
like to determin if it was invoked via SOAP or HTTP Post. Other than
creating 2 methods I am no sure if I can do this.

Many thanks for your time.

Nick.

Since its a web application, i would first try

HttpContext.Current.Request.HttpMethod


Jun 27 '08 #6
Hi Nick,

Generally both http post and SOAP based webservice invoking are over http
POST protocol. And after the requests arrive at ASP.NET side, different
kind of requewst( http get/post or SOAP are handled by different webservice
handler).

But I think your solution on using the "SoapAction" header is really smart
:)

Regards,
Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

--------------------
>From: "Nick" <a@a.com>
References: <#O**************@TK2MSFTNGP03.phx.gbl>
<2e**********************************@x41g2000hsb. googlegroups.com>
<OA**************@TK2MSFTNGP05.phx.gbl>
>Subject: Re: Determin How WebService method was invoked
Date: Tue, 17 Jun 2008 13:25:53 +0100
>
Ahhaa got it...

If (Not
String.IsNullOrEmpty(HttpContext.Current.Request. Headers.Item("SOAPAction")
))
>Then
'//It was a SOAP request
Else
'//It wasn't a SOAP request
End If

excellent, thanks for your time peeps.

"Nick" <a@a.comwrote in message
news:OA**************@TK2MSFTNGP05.phx.gbl...
>Hi Parez,

Thanks for the help, unfortunately that only seems to return GET,
POST
>or HEAD, so SOAP requests return POST. Unfortunately I need to know if
it's a SOAP request.

Maybe I'm misunderstanding something which is quite possible...

Nick.

"parez" <ps*****@gmail.comwrote in message
news:2e**********************************@x41g200 0hsb.googlegroups.com...
>>On Jun 17, 6:51 am, "Nick" <a...@a.comwrote:
Hi there,

Is it possible to tell how a WebMethod was invoked? For example I
would
like to determin if it was invoked via SOAP or HTTP Post. Other than
creating 2 methods I am no sure if I can do this.

Many thanks for your time.

Nick.

Since its a web application, i would first try

HttpContext.Current.Request.HttpMethod



Jun 27 '08 #7
Hi Steven

Cheers for the information that's really helpful, it makes sense why it
was always Post now :)

Thanks.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:Pv**************@TK2MSFTNGHUB02.phx.gbl...
Hi Nick,

Generally both http post and SOAP based webservice invoking are over http
POST protocol. And after the requests arrive at ASP.NET side, different
kind of requewst( http get/post or SOAP are handled by different
webservice
handler).

But I think your solution on using the "SoapAction" header is really smart
:)

Regards,
Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

--------------------
>>From: "Nick" <a@a.com>
References: <#O**************@TK2MSFTNGP03.phx.gbl>
<2e**********************************@x41g2000hsb. googlegroups.com>
<OA**************@TK2MSFTNGP05.phx.gbl>
>>Subject: Re: Determin How WebService method was invoked
Date: Tue, 17 Jun 2008 13:25:53 +0100
>>
Ahhaa got it...

If (Not
String.IsNullOrEmpty(HttpContext.Current.Request .Headers.Item("SOAPAction")
))
>>Then
'//It was a SOAP request
Else
'//It wasn't a SOAP request
End If

excellent, thanks for your time peeps.

"Nick" <a@a.comwrote in message
news:OA**************@TK2MSFTNGP05.phx.gbl...
>>Hi Parez,

Thanks for the help, unfortunately that only seems to return GET,
POST
>>or HEAD, so SOAP requests return POST. Unfortunately I need to know if
it's a SOAP request.

Maybe I'm misunderstanding something which is quite possible...

Nick.

"parez" <ps*****@gmail.comwrote in message
news:2e**********************************@x41g20 00hsb.googlegroups.com...
On Jun 17, 6:51 am, "Nick" <a...@a.comwrote:
Hi there,
>
Is it possible to tell how a WebMethod was invoked? For example I
would
like to determin if it was invoked via SOAP or HTTP Post. Other than
creating 2 methods I am no sure if I can do this.
>
Many thanks for your time.
>
Nick.

Since its a web application, i would first try

HttpContext.Current.Request.HttpMethod




Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: john sparrow | last post by:
Hi There! I have an ATL Server Webservice created with the VS Wizard. In that service I wish to Initialize an ISAPI service (through a call to the m_spServiceProvider member) for that handler....
0
by: James A Taber | last post by:
We've created a webservice using .Net 2003. We got a report from a consumer of the service and did some work to trace down the problem. To reproduce, I created a VB desktop client with a single...
1
by: Jensen Bredal | last post by:
Hello, I have written a very simple web service with only one "web method". The web method does what it is supposed to do when invoked locally but fails one invoked remotelly with http error 500....
7
by: stephan querengaesser | last post by:
hi ng, i try to invoke a webservice-method with an filter-object, that contains value types. if i don´t want to filter the return value of the method, i have to pass a new instance of the...
4
by: MacLanca | last post by:
Hi, I've done the HelloWorld WebService, installed in a WebServer (INTERNET) When I call it with Windows App it works, if I use a webform it doesn’t (INTERNET) Both of them work in the INTRANET...
2
by: Harry Whitehouse | last post by:
I'm coming from an ISAPI background and migrating code to Webservices. In the ISAPI world, there are sections of code that are invoked only once when the DLL is loaded by IIS. It's a place...
0
by: Standist | last post by:
vs.net 2003 I create a webservice using vc.net.In the webservice invoked a method in a dll from third party. I compile and link the program without any error.But I got a error when I debug it,I...
3
by: iw3arv | last post by:
Hello, I've, probably, a simple problem but I'm not able to figure the solution!!! I've realized a web service method that reads an Excel sheet and convert the information in xml. This...
2
by: hvj | last post by:
Does IIS create a separate instance of a webservice for each call to it or if more calls are done at the same time, is it possible that the same instance will be used for more calls? So do I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.