You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by skuramshin <se...@archibus.com> on 2009/09/24 16:44:54 UTC

Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Hi All. My question is about integration between CXF-based 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. I'm using "Java first"
approach, so the WSDL is generated by CXF.

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://datasource.view.model.archibus.com")]
    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://datasource.view.model.archibus.com")]
    public enum SqlDialect {
        GENERIC,
        SYBASE,
        SQL_SERVER,
        ORACLE,
    }

The resulting C# code does not compile:

    The namespace 'xxx' already contains a definition for 'SqlDialect'

This issue does not happen when the default CXF databinding is used instead
of Aegis. In that case, only the second C# enum is generated.

I will appreciate any ideas...
-- 
View this message in context: http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25573591.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by skuramshin <se...@archibus.com>.
Will do. Thank you!
-- 
View this message in context: http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25613411.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by Benson Margulies <bi...@gmail.com>.
Ok, then, please open a JIRA and attach the full pair of WSDL files. I can't
promise anything, but I'll look.

On Fri, Sep 25, 2009 at 8:45 AM, skuramshin
<se...@archibus.com>wrote:

>
>
> bimargulies wrote:
> >
> > Your original message contained the XSD fragment from the enum, from
> > Aegis,
> > that confounded MS. I need to compare it to the corresponding fragment
> > from
> > JAXB that didn't.
> >
>
> I had this thought as well... the WSDL definition for the enum is exactly
> the same, with and without Aegis:
>
>      <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>
>
> --
> View this message in context:
> http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25611511.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by skuramshin <se...@archibus.com>.

bimargulies wrote:
> 
> Your original message contained the XSD fragment from the enum, from
> Aegis,
> that confounded MS. I need to compare it to the corresponding fragment
> from
> JAXB that didn't.
> 

I had this thought as well... the WSDL definition for the enum is exactly
the same, with and without Aegis:

      <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>

-- 
View this message in context: http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25611511.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by Benson Margulies <bi...@gmail.com>.
Your original message contained the XSD fragment from the enum, from Aegis,
that confounded MS. I need to compare it to the corresponding fragment from
JAXB that didn't.



On Fri, Sep 25, 2009 at 7:37 AM, skuramshin
<se...@archibus.com>wrote:

>
> Thank you for responding!
>
>
> bimargulies wrote:
> >
> > to help you with this, I have to ask you to provide two XSD fragments:
> > Aegis
> > and Other.
> >
>
> I'm not using any custom XSD schemas at all...
>
> The service is defined in the Spring configuration. With Aegis databinding:
>
>    <jaxws:endpoint id="testService-ws"
>        implementor="#testService-remote" address="/testService">
>        <jaxws:dataBinding>
>            <ref bean="aegisTestDataBinding" />
>        </jaxws:dataBinding>
>    </jaxws:endpoint>
>
>    <bean id="aegisTestDataBinding"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding"
>        scope="prototype">
>    </bean>
>
> Without Aegis:
>
>    <jaxws:endpoint id="testService-ws"
>        implementor="#testService-remote" address="/testService">
>    </jaxws:endpoint>
>
> --
> View this message in context:
> http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25610518.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by skuramshin <se...@archibus.com>.
Thank you for responding!


bimargulies wrote:
> 
> to help you with this, I have to ask you to provide two XSD fragments:
> Aegis
> and Other.
> 

I'm not using any custom XSD schemas at all... 

The service is defined in the Spring configuration. With Aegis databinding:

    <jaxws:endpoint id="testService-ws"
        implementor="#testService-remote" address="/testService">
        <jaxws:dataBinding>
            <ref bean="aegisTestDataBinding" />
        </jaxws:dataBinding>
    </jaxws:endpoint>

    <bean id="aegisTestDataBinding"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
        scope="prototype">
    </bean>

Without Aegis:

    <jaxws:endpoint id="testService-ws"
        implementor="#testService-remote" address="/testService">
    </jaxws:endpoint>

-- 
View this message in context: http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25610518.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by Benson Margulies <bi...@gmail.com>.
to help you with this, I have to ask you to provide two XSD fragments: Aegis
and Other.


On Thu, Sep 24, 2009 at 10:44 AM, skuramshin
<se...@archibus.com>wrote:

>
> Hi All. My question is about integration between CXF-based 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. I'm using "Java first"
> approach, so the WSDL is generated by CXF.
>
> 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://datasource.view.model.archibus.com")]
>    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://datasource.view.model.archibus.com")]
>    public enum SqlDialect {
>        GENERIC,
>        SYBASE,
>        SQL_SERVER,
>        ORACLE,
>    }
>
> The resulting C# code does not compile:
>
>    The namespace 'xxx' already contains a definition for 'SqlDialect'
>
> This issue does not happen when the default CXF databinding is used instead
> of Aegis. In that case, only the second C# enum is generated.
>
> I will appreciate any ideas...
> --
> View this message in context:
> http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25573591.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by Benson Margulies <bi...@gmail.com>.
I don't know what to advice except to bother Microsoft.

On Tue, Sep 29, 2009 at 9:04 AM, skuramshin
<se...@archibus.com>wrote:

>
> I just found what "makes" Visual Studio to 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
>
>
> --
> View this message in context:
> http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25662677.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Aegis databinding -- Duplicate C# proxy classes generated for Java classes

Posted by skuramshin <se...@archibus.com>.
I just found what "makes" Visual Studio to 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


-- 
View this message in context: http://www.nabble.com/Aegis-databinding----Duplicate-C--proxy-classes-generated-for-Java-classes-tp25573591p25662677.html
Sent from the cxf-user mailing list archive at Nabble.com.