Leo Garcia

Hey,

i'm having a problem with my proxy generation using Visual Studio.
I have design a service and when I add my own faults to it "Add Service Reference" juste stop working!
I do can generate my code, but I can't compile it.
I do see some kind of similar problem when people design services with more than one interface and methods with the same name. But it's not my case.

I will paste some parts of my code:
My interface
Code Snippet

[ServiceContract(Namespace = "http://NouvelleArchitecture.ServiceContracts/2007/04", Name = "IServiceImplementation", SessionMode = SessionMode.Allowed, ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign)]
public interface IServiceImplementation
{
[OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "Initialise")]
[FaultContract(typeof(AccessRefusedException))]
InitialiseReponse Initialise(InitialiseRequest request);

...


InitialiseRequest and Reponse

Code Snippet

[MessageContract]
public class InitialiseRequest
{
private NouvelleArchitecture.DataContracts.DefaultTO DefaultsClientField;

[MessageBodyMember(Order = 0)]
public NouvelleArchitecture.DataContracts.DefaultTO DefaultsClient
{
get { return DefaultsClientField; }
set { DefaultsClientField = value; }
}

[MessageContract]
public class InitialiseReponse
{

}


I created my own exception (AccessRefusedException) using the "Web Service Software Factory" pattern: DefaultFaultContract

I get an error saying that DefaultTO and DefaultFaultContract are already declared in the proxy generated code...

Leo


Re: Windows Communication Foundation (Indigo) Proxy Generation Problem

Leo Garcia

Hey,

just adding some information...
I have duplicated classes in my proxy like that:

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.30")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://NouvelleArchitecture.FaultContracts/2007/04")]
public partial class AccessRefusedException : DefaultFaultContract
{
}

and

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Namespace="http://NouvelleArchitecture.FaultContracts/2007/04")]
[System.SerializableAttribute()]
public partial class AccessRefusedException : NouvelleArchitecture.Client.ProxyServer.DefaultFaultContract
{
}

if I remove the first code of my proxy everything works perfectly!
But why isn't my proxy generation working And what do I have to change

Tks,

PS: One class is generated with svcutil and another with serialization

Leo




Re: Windows Communication Foundation (Indigo) Proxy Generation Problem

Brian McNamara - MSFT

Can you try using svcutil.exe with the /serializer:XmlSerializer flag and see if that works

'Add Service Reference' just uses svcutil with no options, and occasionally there are scenarios where that doesn't work; this appears to be one of those scenarios.






Re: Windows Communication Foundation (Indigo) Proxy Generation Problem

Leo Garcia

Hello Brian,

I've tried to use svcutil with the XmlSerialize option and the duplicated classes are gone!
But there is another error (that happens only with this option activated):

When svcutil generates my code it make a mistake with the FaultContract

Code Snippet

// CODEGEN : La generation du contrat de message depuis le nom de wrapper (InitialiseRequest) du message InitialiseRequest ne correspond pas a la valeur par defaut (Initialise)
[System.ServiceModel.OperationContractAttribute(Action="Initialise", ReplyAction="http://NouvelleArchitecture.ServiceContracts/2007/04/IServiceImplementation/Initi" +
"aliseResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(nouvellearchitecture.faultcontracts._2007._04.AccessRefusedException), Action="http://NouvelleArchitecture.ServiceContracts/2007/04/IServiceImplementation/Initi" +
"aliseAccessRefusedExceptionFault", Name="AccessRefusedException", Namespace="http://NouvelleArchitecture.FaultContracts/2007/04")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(DefaultFaultContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
InitialiseReponse Initialise(InitialiseRequest request);



Look at the fault contract clause and you will see "nouvellearchitecture.faultcontracts._2007._04"... I really don't have this namespace in my project....

And if I use "/serializer:Auto" it write the right code... With a reference for the fault contract serialized....

Any tips

Thank you very much!

Leo Garcia




Re: Windows Communication Foundation (Indigo) Proxy Generation Problem

Brian McNamara - MSFT

Can you try also adding

/n:*,

to the svcutil command line, in addition to the /serializer:xmlserializer






Re: Windows Communication Foundation (Indigo) Proxy Generation Problem

Leo Garcia

Brian,

I've already tried:
svcutil <myServiceExchangeMetadaAddress> /oStick out tongueroxyServer.cs /serializer:XmlSerializer /namespace:*,

and

svcutil <myServiceExchangeMetadaAddress> /oStick out tongueroxyServer.cs /serializer:XmlSerializer /namespace:*,NouvelleArchitecture.Client.ProxyServer

Cuz "NouvelleArchitecture.Client.ProxyServer" it's my namespace that I use in the client side.

Both cases we keep the problem untouched:

Code Snippet

// CODEGEN : La generation du contrat de message depuis le nom de wrapper (InitialiseRequest) du message InitialiseRequest ne correspond pas a la valeur par defaut (Initialise)
[System.ServiceModel.OperationContractAttribute(Action="Initialise", ReplyAction="http://NouvelleArchitecture.ServiceContracts/2007/04/IServiceImplementation/Initi" +
"aliseResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(nouvellearchitecture.faultcontracts._2007._04.AccessRefusedException), Action="http://NouvelleArchitecture.ServiceContracts/2007/04/IServiceImplementation/Initi" +
"aliseAccessRefusedExceptionFault", Name="AccessRefusedException", Namespace="http://NouvelleArchitecture.FaultContracts/2007/04")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(DefaultFaultContract))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
NouvelleArchitecture.Client.ProxyServer.InitialiseReponse Initialise(NouvelleArchitecture.Client.ProxyServer.InitialiseRequest request);







Re: Windows Communication Foundation (Indigo) Proxy Generation Problem

Leo Garcia

I tried to erase ALL namespaces in my code to verify if with the defaults namespaces the error appears....

The problem is still there but the namespace (of course) changed...
What is interesting is that thenew namespace is my default namespace of my solution. Look:

Code Snippet

// CODEGEN : La generation du contrat de message depuis le nom de wrapper (InitialiseRequest) du message InitialiseRequest ne correspond pas a la valeur par defaut (Initialise)
[System.ServiceModel.OperationContractAttribute(Action="Initialise", ReplyAction="http://tempuri.org/IServiceImplementation/InitialiseResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(NouvelleArchitecture.FaultContracts.AccessRefusedException), Action="http://tempuri.org/IServiceImplementation/InitialiseAccessRefusedExceptionFault", Name="AccessRefusedException", Namespace="http://schemas.datacontract.org/2004/07/NouvelleArchitecture.FaultContracts")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(DatabaseException))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(AccessRefusedException))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(object[]))]
NouvelleArchitecture.Client.ProxyServer.InitialiseReponse Initialise(NouvelleArchitecture.Client.ProxyServer.InitialiseRequest request);


And there is the DatabaseException serialized normally:

Code Snippet

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.30")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/NouvelleArchitecture.FaultContracts")]
public partial class DatabaseException
{