This project is read-only.

WSCF blue is generating 2 classes of the same type?

Sep 2, 2009 at 11:08 AM
Edited Sep 2, 2009 at 12:19 PM

Hi all,

I've been working with wscf blue since some time and i ran into the following problem.

I've made xsd's with request and response messages and created a wsdl from them. when i create code from the wsdl i get the following code:

 

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "urn:xxxxx:services:dataservices:huuraanbod:GetActueelSociaalHuuraanbodResponse")]
    public partial class GetActueelSociaalHuuraanbodResponse
    {

        /// <remarks/>
        [System.Xml.Serialization.XmlArrayItemAttribute(IsNullable = false)]
        public VerhuurbareEenheid[] VerhuurbareEenheden;
    }

    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class GetActueelSociaalHuuraanbodResponse1
    {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:xxxxx:services:dataservices:huuraanbod:GetActueelSociaalHuuraanbodResponse", Order=0)]
        public GetActueelSociaalHuuraanbodResponse GetActueelSociaalHuuraanbodResponse;
        
        public GetActueelSociaalHuuraanbodResponse1()
        {
        }
        
        public GetActueelSociaalHuuraanbodResponse1(GetActueelSociaalHuuraanbodResponse GetActueelSociaalHuuraanbodResponse)
        {
            this.GetActueelSociaalHuuraanbodResponse = GetActueelSociaalHuuraanbodResponse;
        }
    }
as you can see there is a Response1 class and a Response class. the Response1 class does contain a public property of the type Response.
the xsd i use for the response is the following:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="GetActueelSociaalHuuraanbodResponse"
    targetNamespace="urn:xxxxx:services:dataservices:huuraanbod:GetActueelSociaalHuuraanbodResponse"
    elementFormDefault="qualified"
    xmlns="urn:xxxxx:services:dataservices:huuraanbod:GetActueelSociaalHuuraanbodResponse"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:vhe="urn:xxxxx:services:dataservices:huuraanbod:VerhuurbareEenheid">
  <xs:import schemaLocation="VerhuurbareEenheid.xsd" namespace="urn:xxxxx:services:dataservices:huuraanbod:VerhuurbareEenheid" />
  <xs:element name="GetActueelSociaalHuuraanbodResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="VerhuurbareEenheden">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="VerhuurbareEenheid" type="vhe:VerhuurbareEenheid" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

What am i doing wrong?
i have build other services that are build exact the same way and they do not have this problem. i want just 1 Response type instead of 2.
kind regards,
Geert van der Cruijsen

Sep 3, 2009 at 6:40 AM

Hi Geert van der Cruijsen,

Are you generating client or service code?

Have you tried naming the complexType instead of nesting it under the element? Something like this:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="GetActueelSociaalHuuraanbodResponse"
    targetNamespace="urn:xxxxx:services:dataservices:huuraanbod:GetActueelSociaalHuuraanbodResponse"
    elementFormDefault="qualified"
    xmlns="urn:xxxxx:services:dataservices:huuraanbod:GetActueelSociaalHuuraanbodResponse"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:vhe="urn:xxxxx:services:dataservices:huuraanbod:VerhuurbareEenheid">
	<xs:import schemaLocation="VerhuurbareEenheid.xsd" namespace="urn:xxxxx:services:dataservices:huuraanbod:VerhuurbareEenheid" />

	<xs:complexType name="GetActueelSociaalHuuraanbodResponse">
		<xs:sequence>
			<xs:element name="VerhuurbareEenheden">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="VerhuurbareEenheid" type="vhe:VerhuurbareEenheid" minOccurs="0" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

Then your message definition would look like this:

<xs:element name="GetActueelSociaalHuuraanbodResponse" type="GetActueelSociaalHuuraanbodResponse" />

If that does not help I may need to look at your complete schema. Let me know if you are not comfortable posting the complete schema here.

Cheers,

Alex.

Sep 3, 2009 at 8:05 AM

Hi Alex,

 

I've seem to kinda solved part of the problem.

 

The weird response1 messages came because i had an empty element in my request message. i'm creating a webservice that has no input parameters and it seems that that is the problem at the moment.

I already made another discussion on how to create a parameterless method here: http://wscfblue.codeplex.com/Thread/View.aspx?ThreadId=67723

so lets continue there.