[quoted text, click to view] John Saunders [MVP] wrote:
> I'd like to create a reproducer for this, because I can see it as an
> issue that will come up for many developers. Unfortunately, I'm tied up
> at the moment and may not get to it in the next couple of days.
I have now simplified the schema and stripped it from all sensitive information, so I can make it public here, for you and others to test. I have also tested that the schema produces the result described. Here's the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns="
http://example.org/Response" xmlns:xs="
http://www.w3.org/2001/XMLSchema" targetNamespace="
http://example.org/Response" elementFormDefault="qualified">
<xs:complexType name="ResponseType">
<xs:sequence>
<xs:element name="ErrorCode" type="xs:string"/>
<xs:element name="ErrorMessage" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ResponseListType">
<xs:sequence>
<xs:element name="Response" type="ResponseType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseList" type="ResponseListType"/>
</xs:schema>
And here's step-by-step instruction on how you produce the same error:
1. Generate a file with classes from the schema with the xsd.exe tool.
2. Create a new Web Service project, and import the generated file.
3. Add a WebMethod that returns a ResponseListType object:
[WebMethod]
public ResponseListType GetResponseList() {
return null;
}
4. Using Object Browser, confirm that the ResponseListType class is included. It is.
5. Create a Console Application project and add a web reference to the web service.
6. Using Object Browser, look for the ResponseListType class among the classes imported by the web reference. It won't be there.
Gustaf