Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2006

Tip: Looking for answers? Try searching our database.

Web Services called directly not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tshad - 28 Mar 2006 00:01 GMT
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.asmx/AddNumbers?lnNumbers1=10&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.WebServiceHandlerFactory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response) +388
  System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext
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
**************************************************************************************************

What is missing?

Thanks,

Tom
Martin Kulov - 28 Mar 2006 00:48 GMT
>I am playing with web Services and soap and in the article I am using I
>created a page:
[quoted text clipped - 14 lines]
> 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,

Signature

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

MCT
MCSD.NET Early Achiever

tshad - 28 Mar 2006 20:38 GMT
That was what I was looking for.

Thanks,

Tom.

>>I am playing with web Services and soap and in the article I am using I
>>created a page:
[quoted text clipped - 36 lines]
>
> HTH,

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.