[Mono-list] Using svcutil to generate WCF proxies

Costantino Pipero cos at beeond.net
Wed Feb 17 07:17:47 EST 2010


I somewhat advanced on this after reading Atsushi Eno's blog .

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 
Sent: Monday, February 15, 2010 6:59 AM
To: 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20100217/b8d7ff05/attachment-0001.html 


More information about the Mono-list mailing list