Results 1 to 3 of 3

Thread: Web service xsd parent element attribute being output as child element?

Threaded View

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Web service xsd parent element attribute being output as child element?

    Hi,

    I'm trying to write a service but there seems to be something not working with my set up. I've generated the .Net serialization classes from my xsd using xsd.exe, so far so good. When I query my webservice for the WSDL (http://services_test.portlandpress.c...rvice.svc?wsdl) and XSD (http://services_test.portlandpress.c...e.svc?xsd=xsd1) the returned XSD shows my attributes as elements instead of an attributes.

    Here is the relevant snippet from the initial XSD -
    Code:
    ...
    <xs:complexType name="ReportRequest">
    	<xs:annotation> 
    		<xs:documentation/> 
    	</xs:annotation>
    	<xs:sequence>
    		<xs:element type="s:Requestor" name="Requestor">
    			<xs:annotation> <xs:documentation>Consumer of the service (client).</xs:documentation> </xs:annotation> 
    		</xs:element>
    		<xs:element type="s:CustomerReference" name="CustomerReference">
    			<xs:annotation> <xs:documentation>Identity of the customer for which data is requested</xs:documentation> </xs:annotation> 
    		</xs:element>
    		<xs:element type="s:ReportDefinition" name="ReportDefinition">
    			<xs:annotation> <xs:documentation>Report paramters including report name, version and filters (e.g. date ranges)</xs:documentation> </xs:annotation> 
    		</xs:element> 
    	</xs:sequence>
    	<xs:attribute type="xs:dateTime" name="Created">
    		<xs:annotation> <xs:documentation>Date/time the request was created</xs:documentation> </xs:annotation> 
    	</xs:attribute> 
    	<xs:attribute type="xs:string" name="ID">
    		<xs:annotation> <xs:documentation>Identifier may be provided by client application for internal use/diagnostics.</xs:documentation> </xs:annotation> 
    	</xs:attribute> 
    </xs:complexType>
    ...
    Here is the same snippet after the call to http://services_test.portlandpress.c...e.svc?xsd=xsd1
    Code:
    ...
    <xs:complexType name="ReportRequest">
    	<xs:sequence>
    		<xs:element name="createdField" type="xs:dateTime"/>
    		<xs:element name="createdFieldSpecified" type="xs:boolean"/>
    		<xs:element name="customerReferenceField" type="tns:CustomerReference" nillable="true"/>
    		<xs:element name="idField" type="xs:string" nillable="true"/>
    		<xs:element name="reportDefinitionField" type="tns:ReportDefinition" nillable="true"/>
    		<xs:element name="requestorField" type="tns:Requestor" nillable="true"/>
    	</xs:sequence>
    </xs:complexType>
    ...
    Any help will be greatly appreciated.

    Cheers Al
    Last edited by aconybeare; Dec 5th, 2012 at 07:37 AM. Reason: Correct typos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width