View Full Version : Could not export PONO as web service
Hello all, I tried to recreate the example in the documentation to expose a PONO as a web service using WebServiceExporter. However, it only works when I add the WebService and WebMethod attributes to the class and method respectively. If I comment out those attributes, I get a 404 when requesting the service. Could this be a bug, or could I be missing something?
Attached is the C# project. Copy the 1.1RC1 binaries and the log4net.dll into the bin directory and you can run the project.
Thanks in advance.
As it turns out, documentation for RC1 was unclear. In the example in the documentation (http://www.springframework.net/docs/1.1-RC1/reference/html/webservices.html#d0e14225), the config file has the following definitions:
<object id="HelloWorld" type="MyApp.Services.HelloWorldService, MyApp">
<property name="Message" value="Hello, World!"/>
</object>
<object id="HelloWorldExporter" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="HelloWorld"/>
</object>
It was not clear in the documentation that the WebServiceExporter would export a web server at HelloWorldExporter.asmx, not HelloWorld.asmx. In other words, one needs to request HelloWorldExporter.asmx instead of HelloWorld.asmx. As a result, if I remove the WebServiceAttribute from the MyApp.Services.HelloWorldService class, Spring would not recognize HelloWorld.asmx as a web service, thus it returns a 404. Anyway, hope this helps someone else in case he/she has the same misunderstanding.
I changed my config to the following and it satisfied my needs:
<object id="HelloWorldImplementation" type="MyApp.Services.HelloWorldService, MyApp">
<property name="Message" value="Hello, World!"/>
</object>
<object id="HelloWorld" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="HelloWorldImplementation"/>
</object>
Bruno Baia
08-30-2007, 02:22 PM
Hi,
note that if your service class already has the WebService and WebMethod attributes, you don't need to use the WebServiceExporter.
- Bruno
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.