none
C# objects generated from wsdl provided by oracle xdb native webservice dublicates classes RRS feed

  • Question

  • i have native oracle XDB webservice and i'm trying to connect to that service from C# application. WSDL example:

    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.oracle.com/orawsv/V7KOOPS/WEBSERVICE" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="WEBSERVICE" targetNamespace="http://xmlns.oracle.com/orawsv/V7KOOPS/WEBSERVICE">
    	<types>
    		<xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/V7KOOPS/WEBSERVICE" elementFormDefault="qualified">
    			<xsd:element name="PROCESSSKUTREEInput">
    				<xsd:complexType>
    					<xsd:sequence>
    						<xsd:element name="ISKUTREE-SKUTREE_XT-CIN" type="tns:SKUTREE_XTType"/>
    					</xsd:sequence>
    				</xsd:complexType>
    			</xsd:element>
    			<xsd:element name="PROCESSSKUTREEOutput">
    				<xsd:complexType>
    					<xsd:sequence></xsd:sequence>
    				</xsd:complexType>
    			</xsd:element>
    			<xsd:complexType name="SKUTREE_XTType">
    				<xsd:sequence>
    					<xsd:element name="SKUTREE_XT">
    						<xsd:complexType>
    							<xsd:sequence>
    								<xsd:element name="ArticleGroupID">
    									<xsd:simpleType>
    										<xsd:restriction base="xsd:string">
    											<xsd:maxLength value="128"/>
    										</xsd:restriction>
    									</xsd:simpleType>
    								</xsd:element>
    								<xsd:element name="ParentID">
    									<xsd:simpleType>
    										<xsd:restriction base="xsd:string">
    											<xsd:maxLength value="128"/>
    										</xsd:restriction>
    									</xsd:simpleType>
    								</xsd:element>
    								<xsd:element name="Description">
    									<xsd:simpleType>
    										<xsd:restriction base="xsd:string">
    											<xsd:maxLength value="2048"/>
    										</xsd:restriction>
    									</xsd:simpleType>
    								</xsd:element>
    							</xsd:sequence>
    						</xsd:complexType>
    					</xsd:element>
    				</xsd:sequence>
    			</xsd:complexType>
    		</xsd:schema>
    	</types>
    	<message name="PROCESSSKUTREEInputMessage">
    		<part name="parameters" element="tns:PROCESSSKUTREEInput"/>
    	</message>
    	<message name="PROCESSSKUTREEOutputMessage">
    		<part name="parameters" element="tns:PROCESSSKUTREEOutput"/>
    	</message>
    	<portType name="WEBSERVICEPortType">
    		<operation name="PROCESSSKUTREE">
    			<input message="tns:PROCESSSKUTREEInputMessage"/>
    			<output message="tns:PROCESSSKUTREEOutputMessage"/>
    		</operation>
    	</portType>
    	<binding name="WEBSERVICEBinding" type="tns:WEBSERVICEPortType">
    		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    		<operation name="PROCESSSKUTREE">
    			<soap:operation soapAction="PROCESSSKUTREE"/>
    			<input>
    				<soap:body parts="parameters" use="literal"/>
    			</input>
    			<output>
    				<soap:body parts="parameters" use="literal"/>
    			</output>
    		</operation>
    	</binding>
    	<service name="WEBSERVICEService">
    		<documentation>Oracle Web Service</documentation>
    		<port name="WEBSERVICEPort" binding="tns:WEBSERVICEBinding">
    			<soap:address location="http://heraklis:8081/orawsv/V7KOOPS/WEBSERVICE"/>
    		</port>
    	</service>
    </definitions>


    svcutil.exe generates class SKUTREE_XTType that have nested class SKUTREE_XTType, so project building failing.

     [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
        [System.Runtime.Serialization.DataContractAttribute(Name="SKUTREE_XTType", Namespace="http://xmlns.oracle.com/orawsv/V7KOOPS/WEBSERVICE")]
        [System.SerializableAttribute()]
        public partial class SKUTREE_XTType : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
    
            [System.NonSerializedAttribute()]
            private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
    
            private DemoNetClient.ServiceReference1.SKUTREE_XTType.SKUTREE_XTType SKUTREE_XTField;
    
            [global::System.ComponentModel.BrowsableAttribute(false)]
            public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
                get {
                    return this.extensionDataField;
                }
                set {
                    this.extensionDataField = value;
                }
            }
    
            [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, EmitDefaultValue=false)]
            public DemoNetClient.ServiceReference1.SKUTREE_XTType.SKUTREE_XTType SKUTREE_XT {
                get {
                    return this.SKUTREE_XTField;
                }
                set {
                    if ((object.ReferenceEquals(this.SKUTREE_XTField, value) != true)) {
                        this.SKUTREE_XTField = value;
                        this.RaisePropertyChanged("SKUTREE_XT");
                    }
                }
            }
    
            public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    
            protected void RaisePropertyChanged(string propertyName) {
                System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
                if ((propertyChanged != null)) {
                    propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
                }
            }
    
            [System.Diagnostics.DebuggerStepThroughAttribute()]
            [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
            [System.Runtime.Serialization.DataContractAttribute(Name="SKUTREE_XTType.SKUTREE_XTType", Namespace="http://xmlns.oracle.com/orawsv/V7KOOPS/WEBSERVICE")]
            [System.SerializableAttribute()]
            public partial class SKUTREE_XTType : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
    
                [System.NonSerializedAttribute()]
                private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
    
                private string ArticleGroupIDField;
    
                private string ParentIDField;
    
                private string DescriptionField;
    
                public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
                    get {
                        return this.extensionDataField;
                    }
                    set {
                        this.extensionDataField = value;
                    }
                }
    
                [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, EmitDefaultValue=false)]
                public string ArticleGroupID {
                    get {
                        return this.ArticleGroupIDField;
                    }
                    set {
                        if ((object.ReferenceEquals(this.ArticleGroupIDField, value) != true)) {
                            this.ArticleGroupIDField = value;
                            this.RaisePropertyChanged("ArticleGroupID");
                        }
                    }
                }
    
                [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, EmitDefaultValue=false)]
                public string ParentID {
                    get {
                        return this.ParentIDField;
                    }
                    set {
                        if ((object.ReferenceEquals(this.ParentIDField, value) != true)) {
                            this.ParentIDField = value;
                            this.RaisePropertyChanged("ParentID");
                        }
                    }
                }
    
                [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, EmitDefaultValue=false, Order=2)]
                public string Description {
                    get {
                        return this.DescriptionField;
                    }
                    set {
                        if ((object.ReferenceEquals(this.DescriptionField, value) != true)) {
                            this.DescriptionField = value;
                            this.RaisePropertyChanged("Description");
                        }
                    }
                }
    
                public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    
                protected void RaisePropertyChanged(string propertyName) {
                    System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
                    if ((propertyChanged != null)) {
                        propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
                    }
                }
            }
        }

    is there some svcutil option or some other solution to don't generate nested classes with same name?



    • Edited by SauliusČ Thursday, May 1, 2014 9:56 AM
    Wednesday, April 23, 2014 1:31 PM

All replies

  • Hi,

    From service side, one of the option could be to have specially crafted single WSDL describing all services. See this article for how to do it.

    On side note, for .NET clients, its quite simple to use wsdl tool with sharetypes options to have common types generated once and re-used among multiple service proxies.

    Also please try to track down the issue as detailed in the following article to generate a valid proxy class without duplicate properties:
    http://developers.de/blogs/damir_dobric/archive/2008/08/24/svcutil-error-cs0102-and-service-modleing.aspx .


    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 24, 2014 9:12 AM
    Moderator
  • My problem is different, classes is generated from one wsdl file. SKUTREE_XTType has nested class SKUTREE_XTType. Can you explain why? In wsdl i don't see dublication of type SKUTREE_XTType .
    • Edited by SauliusČ Thursday, April 24, 2014 11:33 AM
    Thursday, April 24, 2014 11:31 AM
  • I have seen that i'm missed a part of wsdl, i updated that now. Can you now offer a solution how to fix that problem?
    Thursday, May 1, 2014 10:02 AM