Reputation: 21
My question is about integration between a Java web service and a C# .NET client.
Service: CXF 2.2.3 with Aegis databinding Client: C#, .NET 3.5 SP1
For some reason Visual Studio generates two C# proxy enums for each Java enum. The generated C# classes do not compile.
For example, this Java enum:
public enum SqlDialect {
GENERIC, SYBASE, SQL_SERVER, ORACLE;
}
Produces this WSDL:
<xsd:simpleType name="SqlDialect">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="GENERIC" />
<xsd:enumeration value="SYBASE" />
<xsd:enumeration value="SQL_SERVER" />
<xsd:enumeration value="ORACLE" />
</xsd:restriction>
</xsd:simpleType>
For this WSDL Visual Studio generates two partial C# classes (generated comments removed):
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="SqlDialect", Namespace="http://somenamespace")]
public enum SqlDialect : int {
[System.Runtime.Serialization.EnumMemberAttribute()]
GENERIC = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
SYBASE = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
SQL_SERVER = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
ORACLE = 3,
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://somenamespace")]
public enum SqlDialect {
GENERIC,
SYBASE,
SQL_SERVER,
ORACLE,
}
The resulting C# code does not compile:
The namespace 'somenamespace' already contains a definition for 'SqlDialect'
I will appreciate any ideas...
Upvotes: 1
Views: 2667
Reputation: 4115
I think to add this WSDL using visual studio 2008, it should support SOAP 1.1 , check the version of this SOAP using soapUI application or similar apps.
Upvotes: 0
Reputation: 1851
You could also try alternative proxy generator http://wscfblue.codeplex.com/ , which seems to handle this kind of problem.
Upvotes: 0
Reputation: 1
Try adding the service referance as a .net 2 referance; use add service referance > advanced > add web reference...
Upvotes: 0
Reputation: 21
I found what "makes" Visual Studio generate duplicate proxy classes... Our web service data model is polymorphic and uses abstract classes - this is essentially why we use Aegis databinding. If there is more than one abstract class in the hierarchy, Visual Studio will generate duplicate proxies.
For example, in this web service contract:
AbstractRestrictionDef getRestriction(...parameters...)
these classes would not work:
abstract class AbstractModelObject -– abstract class AbstractRestrictionDef –- class SqlRestrictionDef
but these classes would:
abstract class AbstractModelObject -– class AbstractRestrictionDef -– class ParsedRestrictionDef
Upvotes: 1
Reputation: 1235
For certain WSDLs, I have had extra code generated (in my case, extra class members that didn't exist). This caused problems when trying to use it, so I just deleted the code I identified as excess and it started working. I'd try deleting one of the enums and seeing what happens.
Upvotes: 0