Hello,

I am having trouble running a WCF Soap WebService including servicing
WSDL. I created a small example for reproducing the error.
The example is attached. Just compile it referencing System.ServiceModel
(I tried with both gmcs and dmcs, mono 2.10.6), run and check
http://127.0.0.1:8000/myHelloService?wsdl

I get:
XmlSchema error: Named item http://some.other.tempuri.org/:Hello was
already contained in the schema object table. Consider setting
MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation. Related
schema item SourceUri: , Line 0, Position 0.

A common error, as searching mono-list and other resources on the web
indicates, and setting MONO_STRICT_MS_COMPLIANT to "yes" fixes this, indeed.
However, I feel like this is a workaround. It seems there is something
wrong going on here. Probably I forgot about something. Any idea what is it?

One more thing I would like to ask: I am trying to get rid of all
http://tempuri.org/ in WSDLs, however there is one more left in the main
XML tag:
<definitions name="service" targetNamespace="http://tempuri.org/";>
...
</definitions>
I tried setting Namespace in various properties inside the ServiceHost
class, but with no success. Any idea how to change it?

It seems like it is being set to tempuri somewhere around
mono-2.10.6/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs,
line 191 (or search for tempuri in this file). Unfortunately I don't
know how to fix it (that is, if it is a bug indeed).

Regards,
Peter
using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace WebServiceExample
{
	[ServiceContract (Namespace = "http://some.other.tempuri.org/";)]
	interface HelloService {
		[OperationContract]
		void Hello ();
	}
	
	[ServiceBehavior (InstanceContextMode = InstanceContextMode.Single, Namespace = "http://some.other.tempuri.org/";)]
	class HelloServiceImpl : HelloService {
		void HelloService.Hello () {}
	}
	
	class MainClass
	{
		public static void Main (string[] args)
		{
			HelloService helloService = new HelloServiceImpl ();
			var addr = new Uri ("http://127.0.0.1:8000/myHelloService";);
			var host = new ServiceHost (helloService, addr);
			
			host.Description.Behaviors.Remove<ServiceMetadataBehavior> ();
            host.Description.Behaviors.Add (new ServiceMetadataBehavior { HttpGetEnabled = true });
			
			host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
            host.Description.Behaviors.Add (new ServiceDebugBehavior { IncludeExceptionDetailInFaults = true });
			
			host.AddServiceEndpoint (typeof (HelloService).FullName, new BasicHttpBinding (), addr);
			
			host.Open ();
			
			Console.WriteLine("The service is ready.");
            Console.WriteLine("Press <ENTER> to terminate service.");
            Console.WriteLine();
            Console.ReadLine();
			
			host.Close ();
			Environment.Exit (0);
		}
	}
}

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to