Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Web Services called directly not working

Reply
Thread Tools

Web Services called directly not working

 
 
tshad
Guest
Posts: n/a
 
      03-27-2006
I am playing with web Services and soap and in the article I am using I
created a page:

************************************************** *********************
<%@ WebService Language="c#" Class="FirstWebService" %>

using System;
using System.Web;
using System.Web.Services;

public class FirstWebService {

[WebMethod]
public string HelloWorld(string lcName) {
return "Hello World, " + lcName;
}

[WebMethod]
public decimal AddNumbers(decimal lnNumber1, decimal lnNumber2) {
return lnNumber1 + lnNumber2;
}

/*

[WebMethod]

public DateTime GetServerTime() {

return DateTime.Now;

} */
}
************************************************** *********************

If I call http://localhost/FirstWebService.asmx, I get the services test
windows fine.

But if I do:
http://localhost/FirstWebService.asm...0&lnNumber2=20

I get an error:
************************************************** *********************************
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.WebServiceHandlerFac tory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response) +388
System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContext
context, String verb, String url, String filePath) +94
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig) +699
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
+95
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +173
************************************************** ************************************************

What is missing?

Thanks,

Tom


 
Reply With Quote
 
 
 
 
Martin Kulov
Guest
Posts: n/a
 
      03-27-2006
"tshad" <> wrote in message
news:...
>I am playing with web Services and soap and in the article I am using I
>created a page:
>
> If I call http://localhost/FirstWebService.asmx, I get the services test
> windows fine.
>
> But if I do:
> http://localhost/FirstWebService.asm...0&lnNumber2=20
>
> I get an error:
> ************************************************** *********************************
> 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.


> What is missing?
>
> Thanks,
>
> Tom


Hi Tom,

you can issue GET request only from the localhost by default for debugging
purposes only. Using GET requests in production environment is considered
insecure due to some XSS problems.
Still if you need to enable it use the following configuration in
web.config:

<webServices>
<protocols>
<add name="HttpGet"/>
</protocols>
</webServices>

HTH,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MCT
MCSD.NET Early Achiever


 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      03-28-2006
That was what I was looking for.

Thanks,

Tom.

"Martin Kulov" <> wrote in message
news:...
> "tshad" <> wrote in message
> news:...
>>I am playing with web Services and soap and in the article I am using I
>>created a page:
>>
>> If I call http://localhost/FirstWebService.asmx, I get the services test
>> windows fine.
>>
>> But if I do:
>> http://localhost/FirstWebService.asm...0&lnNumber2=20
>>
>> I get an error:
>> ************************************************** *********************************
>> 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.

>
>> What is missing?
>>
>> Thanks,
>>
>> Tom

>
> Hi Tom,
>
> you can issue GET request only from the localhost by default for debugging
> purposes only. Using GET requests in production environment is considered
> insecure due to some XSS problems.
> Still if you need to enable it use the following configuration in
> web.config:
>
> <webServices>
> <protocols>
> <add name="HttpGet"/>
> </protocols>
> </webServices>
>
> HTH,
>
> --
> Martin Kulov
> http://www.codeattest.com/blogs/martin
>
> MCT
> MCSD.NET Early Achiever
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
code displays PDF directly from Windows explorer but not when called by II6 to Internet explorer Ed Hauptman HTML 7 08-07-2009 10:11 PM
How .NET web services client handles exceptions from Java web services? John ASP .Net Web Services 4 03-31-2006 10:13 PM
how the page is called directly from URL or <a> tag in other page? haode ASP General 1 06-12-2004 08:17 AM
Preview image directly on PC, save directly to HD Patrick M. Digital Photography 3 01-07-2004 08:29 PM
Adding web reference to consume multiple web services not working. Saumendra ASP .Net 0 06-24-2003 10:23 PM



Advertisments