Re: [Mono-dev] Fwd: Problem with WCF and IEnumerable as return type

2010-12-07 Thread Atsushi Eno
Please file a bug (C# is much better).

Atsushi Eno

(2010/12/07 16:14), Chakotey STME wrote:
 This problem still exists.

 Does anyone have an idea?


 -- Forwarded message --
 From: Chakotey STMEchakoteys...@gmail.com
 Date: 2010/11/30
 Subject: Problem with WCF and IEnumerable as return type
 To: mono-devel-list@lists.ximian.com


 Hello,

 I have a problem with WCF.

 If I have this service contract:

 ServiceContract()  _
 Public Interface IHelloService
 OperationContract()  _
 Function Greet(ByVal name As String) As IEnumerable(Of Objekt)
 End Interface

 This Service:
 Imports System.ServiceModel

 Module Module1
 Sub Main()
 Dim host As ServiceHost = New ServiceHost(GetType(HelloService))
 host.Open()
 End Sub
 End Module

 The implementaion of HelloService of the Service:
 Imports Contracts

 Public Class HelloService
 Implements IHelloService
 Public Function Greet(ByVal name As String) As IEnumerable(Of
 Objekt) Implements IHelloService.Greet
 Dim myObjekt As Objekt = New Objekt
 Dim myObjekt2 As Objekt = New Objekt

 myObjekt.text = Hallo
 myObjekt.number = 3 + name.Length

Dim list As IList(Of Objekt) = New List(Of Objekt)

 list.Add(myObjekt)
 list.Add(myObjekt2)

 Return list

 End Function

 End Class


 And this client:
 Imports System.ServiceModel
 Imports Contracts

 Module Module1

 Sub Main()
 Dim binding = New BasicHttpBinding()
 Dim address = New EndpointAddress(http://192.168.100.110:8080;)
 Dim client = New HelloClient(binding, address)
 Dim myObjekt = client.Greet(name)

 Console.ReadLine()
 End Sub
 End Module

 The implementation of HelloService from the client:

 Imports System.ServiceModel
 Imports System.ServiceModel.Channels
 Imports System.Runtime.Serialization
 Imports Contracts

 Public Class HelloClient
 Inherits ClientBase(Of IHelloService)
 Implements IHelloService
 Public Sub New(ByVal binding As Binding, ByVal address As EndpointAddress)
 MyBase.New(binding, address)
 End Sub

 Public Function Greet(ByVal name As String) As IEnumerable(Of
 Objekt) Implements IHelloService.Greet
 Return Channel.Greet(name)
 End Function
 End Class


 I execute the service and execute the client.
 I get this Exception:
 Exception Non-empty prefix must be mapped to non-empty namespace URI.
   at System.Xml.XmlTextWriter.WriteEndAttribute () [0x0] in
 filename unknown:0
   at System.Xml.XmlSimpleDictionaryWriter.WriteEndAttribute ()
 [0x0] infilename unknown:0
   at System.Xml.XmlWriter.WriteAttributeString (System.String prefix,
 System.String localName, System.String ns, System.String value)
 [0x0] infilename unknown:0
   at System.Xml.XmlDictionaryWriter.WriteXmlnsAttribute (System.String
 prefix, System.String namespaceUri) [0x0] infilename unknown:0
   at System.Runtime.Serialization.DataContractSerializer.WriteStartObject
 (System.Xml.XmlDictionaryWriter writer, System.Object graph) [0x0]
 infilename unknown:0
   at System.Runtime.Serialization.XmlObjectSerializer.WriteObject
 (System.Xml.XmlDictionaryWriter writer, System.Object graph) [0x0]
 infilename unknown:0
   at 
 System.ServiceModel.Dispatcher.DataContractMessagesFormatter+DataContractBodyWriter.WriteMessagePart
 (System.Xml.XmlDictionaryWriter writer,
 System.ServiceModel.Description.MessageBodyDescription desc,
 System.ServiceModel.Description.MessagePartDescription partDesc,
 System.Object obj) [0x0] infilename unknown:0
   at 
 System.ServiceModel.Dispatcher.DataContractMessagesFormatter+DataContractBodyWriter.OnWriteBodyContents
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.BodyWriter.WriteBodyContents
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.SimpleMessage.OnWriteBodyContents
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.Message.WriteBodyContents
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.Message.WriteBody
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.Message.OnWriteMessage
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.Message.WriteMessage
 (System.Xml.XmlDictionaryWriter writer) [0x0] infilename
 unknown:0
   at System.ServiceModel.Channels.TextMessageEncoder.WriteMessage
 (System.ServiceModel.Channels.Message message, System.IO.Stream
 stream) [0x0] infilename unknown:0
   at System.ServiceModel.Channels.HttpRequestContext.ProcessReply
 (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0]
 infilename unknown:0
   at System.ServiceModel.Channels.HttpRequestContextBase.Reply
 

[Mono-dev] Fwd: Problem with WCF and IEnumerable as return type

2010-12-06 Thread Chakotey STME
This problem still exists.

Does anyone have an idea?


-- Forwarded message --
From: Chakotey STME chakoteys...@gmail.com
Date: 2010/11/30
Subject: Problem with WCF and IEnumerable as return type
To: mono-devel-list@lists.ximian.com


Hello,

I have a problem with WCF.

If I have this service contract:

ServiceContract() _
Public Interface IHelloService
   OperationContract() _
   Function Greet(ByVal name As String) As IEnumerable(Of Objekt)
End Interface

This Service:
Imports System.ServiceModel

Module Module1
   Sub Main()
       Dim host As ServiceHost = New ServiceHost(GetType(HelloService))
       host.Open()
   End Sub
End Module

The implementaion of HelloService of the Service:
Imports Contracts

Public Class HelloService
   Implements IHelloService
   Public Function Greet(ByVal name As String) As IEnumerable(Of
Objekt) Implements IHelloService.Greet
       Dim myObjekt As Objekt = New Objekt
       Dim myObjekt2 As Objekt = New Objekt

       myObjekt.text = Hallo
       myObjekt.number = 3 + name.Length

      Dim list As IList(Of Objekt) = New List(Of Objekt)

       list.Add(myObjekt)
       list.Add(myObjekt2)

       Return list

   End Function

End Class


And this client:
Imports System.ServiceModel
Imports Contracts

Module Module1

   Sub Main()
       Dim binding = New BasicHttpBinding()
       Dim address = New EndpointAddress(http://192.168.100.110:8080;)
       Dim client = New HelloClient(binding, address)
       Dim myObjekt = client.Greet(name)

       Console.ReadLine()
   End Sub
End Module

The implementation of HelloService from the client:

Imports System.ServiceModel
Imports System.ServiceModel.Channels
Imports System.Runtime.Serialization
Imports Contracts

Public Class HelloClient
   Inherits ClientBase(Of IHelloService)
   Implements IHelloService
   Public Sub New(ByVal binding As Binding, ByVal address As EndpointAddress)
       MyBase.New(binding, address)
   End Sub

   Public Function Greet(ByVal name As String) As IEnumerable(Of
Objekt) Implements IHelloService.Greet
       Return Channel.Greet(name)
   End Function
End Class


I execute the service and execute the client.
I get this Exception:
Exception Non-empty prefix must be mapped to non-empty namespace URI.
 at System.Xml.XmlTextWriter.WriteEndAttribute () [0x0] in
filename unknown:0
 at System.Xml.XmlSimpleDictionaryWriter.WriteEndAttribute ()
[0x0] in filename unknown:0
 at System.Xml.XmlWriter.WriteAttributeString (System.String prefix,
System.String localName, System.String ns, System.String value)
[0x0] in filename unknown:0
 at System.Xml.XmlDictionaryWriter.WriteXmlnsAttribute (System.String
prefix, System.String namespaceUri) [0x0] in filename unknown:0
 at System.Runtime.Serialization.DataContractSerializer.WriteStartObject
(System.Xml.XmlDictionaryWriter writer, System.Object graph) [0x0]
in filename unknown:0
 at System.Runtime.Serialization.XmlObjectSerializer.WriteObject
(System.Xml.XmlDictionaryWriter writer, System.Object graph) [0x0]
in filename unknown:0
 at 
System.ServiceModel.Dispatcher.DataContractMessagesFormatter+DataContractBodyWriter.WriteMessagePart
(System.Xml.XmlDictionaryWriter writer,
System.ServiceModel.Description.MessageBodyDescription desc,
System.ServiceModel.Description.MessagePartDescription partDesc,
System.Object obj) [0x0] in filename unknown:0
 at 
System.ServiceModel.Dispatcher.DataContractMessagesFormatter+DataContractBodyWriter.OnWriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.BodyWriter.WriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.SimpleMessage.OnWriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.Message.WriteBodyContents
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.Message.WriteBody
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.Message.OnWriteMessage
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.Message.WriteMessage
(System.Xml.XmlDictionaryWriter writer) [0x0] in filename
unknown:0
 at System.ServiceModel.Channels.TextMessageEncoder.WriteMessage
(System.ServiceModel.Channels.Message message, System.IO.Stream
stream) [0x0] in filename unknown:0
 at System.ServiceModel.Channels.HttpRequestContext.ProcessReply
(System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0]
in filename unknown:0
 at System.ServiceModel.Channels.HttpRequestContextBase.Reply
(System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0]
in filename unknown:0
 at System.ServiceModel.Dispatcher.MessageProcessingContext.Reply
(Boolean useTimeout) [0x0] in filename unknown:0
 at