PDA

View Full Version : Exporting a Web Service using an interface?


choenes
02-10-2006, 10:20 PM
I am trying to expose an entire interface as a web service:


public interface IHelloWorld
{
string SayHello();
}


public class HelloWorld : IHelloWorld
{
public string SayHello()
{
return "Hello!";
}
}



My app-objects.xml file looks like this:


<objects xmlns="http://www.springframework.net">
<object name="SimpleWebService" type="SimpleWebService.HelloWorld, SimpleWebService"/>
<object id="SimpleWebServiceExporter" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="SimpleWebService"/>
<property name="Namespace" value="http://HenrySchein/SimpleWebService"/>
<property name="Description" value="A simple web service."/>

<property name="Interfaces">
<list>
<value>SimpleWebService.IHelloWorld, SimpleWebService</value>
</list>
</property>

</object>
</objects>


If I put the [WebService] and [WebMethod] attributes on my HelloWorld class I do get the SayHello method exposed but without the attributes I don't get any methods exposed. I am using Spring.NET-20060209-0516.

[/code]

Aleks Seovic
02-11-2006, 02:07 AM
Strange, your configuration looks perfectly fine...

Are you accessing web service using SimpleWebServiceExporter.asmx as a URL? I did change how endpoint URLs are determined recently -- instead of using Name proeprty to specify it, it simply uses exporter's object id.

Another thing I would try is removing Interfaces property, as you don't technically need it. If it starts working without Interfaces property let me know and I'll fix it, because that would be an obvious bug.

Regards,

Aleks

choenes
02-13-2006, 03:46 PM
I just needed to access via the "SimpleWebServiceExporter.asmx" URL. Is there a way to not expose SimpleWebService.asmx?

It's confusing that even though I explicitly export the web service it comes up with the SimpleWebService.asmx URL as well.

Bruno Baia
02-13-2006, 04:18 PM
Are you using a .asmx file that you created with Visual Studio ?
because in your case you don't need it.

-Bruno