Calling a WebService through HTTP GET ? (HELP!)

  • Thread starter Thread starter Benne Smith
  • Start date Start date
B

Benne Smith

Hi,

I have a simple webservice, with one function on the following local path :

http://localhost/testws/tester.asmx

I would like to call it, using HTTP GET (or some form of simple, url with
all the parameters in), like this;

http://localhost/testws/tester.asmx/myfunction?param1=hello&param2=world

But it does not work ? It comes with the following error;

Thanks,

Benne

Server Error in '/activation' Application.
----------------------------------------------------------------------------
----

Request format is unrecognized.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Request format is
unrecognized.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: Request format is unrecognized.]

System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response) +388

System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContex
t context, String verb, String url, String filePath) +94
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig) +699

System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
..Execute() +95
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +173
 
There is a subtle difference between .NET Framework 1.0 and 1.1 regarding
the 'protocols' that are permitted to communicate with a WebService.

By default, you can use SOAP, GET or POST method to communicate with a
WebService running on 1.0. But in version 1.1, only SOAP is enabled by
default.

You have to add the following settings to you Web.config file to re-enable
GET/POST methods.

Example:

<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
</protocols>
</webServices>

Edward

Benne Smith said:
Hi,

I have a simple webservice, with one function on the following local path :

http://localhost/testws/tester.asmx

I would like to call it, using HTTP GET (or some form of simple, url with
all the parameters in), like this;

http://localhost/testws/tester.asmx/myfunction?param1=hello&param2=world

But it does not work ? It comes with the following error;

Thanks,

Benne

Server Error in '/activation' Application.
-------------------------------------------------------------------------- --
----

Request format is unrecognized.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Request format is
unrecognized.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: Request format is unrecognized.]

System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response) +388System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContex
t context, String verb, String url, String filePath) +94
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig) +699System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep
.Execute() +95
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +173
 
Back
Top