[Mono-list] Using svcutil to generate WCF proxies
Atsushi Eno
atsushieno at veritas-vos-liberabit.com
Thu Feb 18 02:18:24 EST 2010
Oops, I missed the first post. So, hello,
There were couple of bugs around ServiceMetadataBehavior (support for wsdl).
WCF in trunk has a couple of fixes with related to this kind of issue.
Though there still likely are other issues. I have written some notes on how
WSDL support in both simple ServiceHost and ASP.NET is done (and how they
are messy :/ ) at
http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System.ServiceModel/HTTP_listener_notes.txt?view=co
A possible workaround for your issue is to use non-empty HttpGetUrl such as
"/wsdl" which will expose WSDL at .../foo.svc/wsdl instead of
../foo.svc?wsdl .
Atsushi Eno
On 2010/02/17 21:17, Costantino Pipero wrote:
> I somewhat advanced on this after reading Atsushi Eno's blog
> <http://veritas-vos-liberabit.com/monogatari/2009/12/mono-wcf-advent-day-4-expose-and-consume-wsdls.html>
> .
> When I point the browser to http://localhost:8080/wsdl I get
> "This XML file does not appear to have any style information
> associated with it. The document tree is shown below."
>
> −
> <s:Envelope>
> −
> <s:Body>
> −
> <s:Fault>
> <faultcode>a:DestinationUnreachable</faultcode>
> <faultstring xml:lang="en-US">error occured</faultstring>
> </s:Fault>
> </s:Body>
> </s:Envelope>
> Here's my simple (server side) code:
> namespace SimpleMessageService
> {
> [ServiceContract]
> public interface ISimpleMessage
> {
> [OperationContract]
> string SendMessage();
> }
> public class SimpleMessage : ISimpleMessage
> {
> public string SendMessage()
> {
> return "This is a very simple message";
> }
> }
>
> class MainClass
> {
> public static void Main (string[] args)
> {
> var binding = new BasicHttpBinding ();
> var address = new Uri (http://localhost:8080/);
> var host = new ServiceHost (typeof (SimpleMessage));
> var meta = new ServiceMetadataBehavior()
> {
> HttpGetEnabled = true,
> HttpGetUrl = new Uri("wsdl",UriKind.Relative)
> };
> host.Description.Behaviors.Add(meta);
> host.AddServiceEndpoint(
> typeof (ISimpleMessage), binding, address);
> host.Open ();
> Console.WriteLine("Host listening on {0} with status: {1}",
> host.Description.Endpoints[0].Address, host.State);
> Console.WriteLine ("SimpleMessageService running, press ENTER to
> stop it...");
> Console.ReadLine ();
> host.Close ();
> }
> }
> }
> Thank you for any help on this
> Cos
>
> *From:* Costantino Pipero <mailto:cos at beeond.net>
> *Sent:* Monday, February 15, 2010 6:59 AM
> *To:* mono-list at lists.ximian.com <mailto:mono-list at lists.ximian.com>
> *Subject:* [Mono-list] Using svcutil to generate WCF proxies
>
> Hello,
> I have Mono 2.6 on OpenSuse 11.2 and I am trying out WCF.
>
> Everything works as expected, I created a service hosted in a console
> app and a client on another app, like the example on the Mono Olive
> Notebook.
> It works, but it works because I reference the server class in the
> client.
> Instead I want to generate a proxy using svcutil like it should be
> done if you want to consume from a remote web service that you don't
> have the source for.
> I tried several things like:
> svcutil http://lcalhost:8080/MyService.svc?wsdl -o myfile.cs
> svcutil http://lcalhost:8080/MyService.svc|wsdl -o myfile.cs
> svcutil MyService.exe -o myfile.cs
> I some case the prompt sits there and does nothing, in others it
> throws numerous exceptions. Before I show the laundry list of errors I
> wanted to check if I am taking the right approach...
> Thanks
> Cos
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
More information about the Mono-list
mailing list