以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DTD/XML Schema 』  (http://bbs.xml.org.cn/list.asp?boardid=23)
----  XSD的结构问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=121869)


--  作者:JamesTeng
--  发布时间:10/4/2011 7:28:00 AM

--  XSD的结构问题
调用一个WebService,有一个WSDL和一个XSD,在调用的时候想产生这样的SOAP消息结构

.....
<Payload>
   <document ..... />
   <document .... />
</Payload>

但是根据现在的XSD产生的结构却是
<Payload>
   <Payload .... />
  <Payload ..../>
</Payload>

xsd file 结构=================
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="urn:CIMMessageEnvelope.technology.cim.data.xxx.xxx.xxx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:CIMMessageEnvelope.technology.cim.data.xxx.xxx.xxx" elementFormDefault="qualified">
 <xsd:complexType name="CIMMessageEnvelopeType">
  <xsd:annotation>
   <xsd:documentation>Envelope of CIM carrying the payload information</xsd:documentation>
  </xsd:annotation>
  <xsd:sequence>
   <xsd:element ref="Header"/>
   <xsd:element ref="Payload" minOccurs="0"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="DocumentType">
  <xsd:sequence>
   <xsd:any namespace="##any" processContents="lax"/>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="HeaderType">
  <xsd:annotation>
   <xsd:documentation>Message Envelope header information</xsd:documentation>
  </xsd:annotation>
  <xsd:sequence>
   <xsd:element ref="Delivery" minOccurs="0">
    <xsd:annotation>
     <xsd:documentation>Message delivery details (sender and receiver)</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
   <xsd:element ref="PayloadManifest" minOccurs="0">
    <xsd:annotation>
     <xsd:documentation>The payload that is carried with the message. The payload could be one or more XML documents or one or more attachments</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
   <xsd:element ref="TargetSystems" minOccurs="0">
    <xsd:annotation>
     <xsd:documentation>Details of the systems that will process this message. The message could go to multiple systems</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
   <xsd:element name="BusinessProcessName" type="xsd:string" minOccurs="0">
    <xsd:annotation>
     <xsd:documentation>Name of the business process (e.g. AVO, WARRANTS, CPR, etc). This business process is part of the business service namely, Legal Action, Investigations, etc. Business activity software service is an activity under the business process</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
   <xsd:element ref="Service" minOccurs="0">
    <xsd:annotation>
     <xsd:documentation>Business activity software service details as part of a business process (e.g. AVO Interim order as part of AVO business process. CourtOutcome is a business process and an AVO final order as part of Court Outcome is a business activity).</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
   <xsd:element ref="CustomAttributes" minOccurs="0" maxOccurs="unbounded">
    <xsd:annotation>
     <xsd:documentation>Any other specific attributes that are not covered by the defined elements. This could be project specific. e.g. MQ Message ID</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
  </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="PayloadType">
  <xsd:sequence>
   <xsd:element ref="Document" minOccurs="0">
    <xsd:annotation>
     <xsd:documentation>The payload (could be XML document or non XML document)</xsd:documentation>
    </xsd:annotation>
   </xsd:element>
  </xsd:sequence>
 </xsd:complexType>
 <!---->
 <xsd:element name="CIMMessageEnvelope">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Header">
     <xsd:annotation>
      <xsd:documentation>The metadata information details about the message</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Payload" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>The payload details of the message</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Address" type="xsd:string"/>
 <xsd:element name="AddressType" type="xsd:string"/>
 <xsd:element name="AttachmentDetails">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Index" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Index of the attachment</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="FileName" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Name of the file as attachment</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Description" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Description of the file as attachment</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Type" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>File type</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="URL" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>URL of the location of the file</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Context" type="xsd:string"/>
 <xsd:element name="CustomAttributes">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Name">
     <xsd:annotation>
      <xsd:documentation>name of the attribute (the metadata)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Value">
     <xsd:annotation>
      <xsd:documentation>Value of the metadata (the data)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Description" type="xsd:string"/>
 <xsd:element name="Delivery">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Message" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Container defining the metadata information about the message</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="To" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Container to define the end point address to which the message has to be sent  (RECEIVER)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="From" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Container to define the end point address of the origin of the message (SENDER)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="MessageExchangePattern" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Type of message processing namely, synchronous or asynchronous
Synchronous =  0
Asynchronous = 1
</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
   <xsd:attribute name="DeliveryType">
    <xsd:annotation>
     <xsd:documentation>Type of delivery and carries 2 values (0 or 1)
0- Internal within
1- External to

Default is 0</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleType>
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="0">
       <xsd:annotation>
        <xsd:documentation>Internal within </xsd:documentation>
       </xsd:annotation>
      </xsd:enumeration>
      <xsd:enumeration value="1">
       <xsd:annotation>
        <xsd:documentation>External to </xsd:documentation>
       </xsd:annotation>
      </xsd:enumeration>
     </xsd:restriction>
    </xsd:simpleType>
   </xsd:attribute>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="DocumentDetails">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Name" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>XML Schema Name (the root node) of the XML document being added to the envelope.</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Namespace" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>The namespace of the XSD Schema that this document is an instance of</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Description" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Description of the XML document</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
   <xsd:attribute name="RefKey" type="xsd:integer">
    <xsd:annotation>
     <xsd:documentation>Assign a unique number to teh document if more than one document. This will be the same number used in the body</xsd:documentation>
    </xsd:annotation>
   </xsd:attribute>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Document">
  <xsd:complexType>
   <xsd:complexContent>
    <xsd:extension base="DocumentType">
     <xsd:attribute name="RefKey" type="xsd:integer"/>
    </xsd:extension>
   </xsd:complexContent>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Environment" type="xsd:string"/>
 <xsd:element name="From">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Name" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Name of the sender (e.g. )</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Address" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Name of the receiver (e.g. DPP, AGD) when the client determines where the request is destined (i.e. when the ESB acts as an EAI Server). Otherwise it can be 'ESB' when the ESB knows exactly what to do with the message (SOA).</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="AddressType" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>An optional type that specifies the transport type. It overrides any Transport Type information from the "address" element</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="FileName" type="xsd:string"/>
 <xsd:element name="Handle" type="xsd:string"/>
 <xsd:element name="Header" type="HeaderType"/>
 <xsd:element name="Index" type="xsd:string"/>
 <xsd:element name="Message">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="SenderMessageID" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>A message ID of the message sent to the client . Could be a correlation message ID or a business message ID also</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="ReceiverMessageID" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>A message ID of the message received from the client. Could be a correlation message ID or business message ID also</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="SentTimeStamp" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Timestamp of when the message was sent by the client</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="ReceivedTimeStamp" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Timestamp of when the message was received from the client</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Subject" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>General description about the message</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Name" type="xsd:string"/>
 <xsd:element name="Namespace" type="xsd:string"/>
 <xsd:element name="Payload" type="PayloadType"/>
 <xsd:element name="PayloadManifest">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="DocumentDetails" minOccurs="0" maxOccurs="unbounded">
     <xsd:annotation>
      <xsd:documentation>One or more XML documents that are enclosed as payloads</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="AttachmentDetails" minOccurs="0" maxOccurs="unbounded">
     <xsd:annotation>
      <xsd:documentation>Other formats (non XML) are recommended to be referenced here as attachments for performance reasons. These attachments ARE NOT CONTAINED WITH THIS PAYLOAD ENVELOPE. Instead references to external artefacts and are moved around/managed by transport adapters or by other means</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Process" type="xsd:string"/>
 <xsd:element name="MessageExchangePattern">
  <xsd:simpleType>
   <xsd:restriction base="xsd:string">
    <xsd:enumeration value="0"/>
    <xsd:enumeration value="1"/>
   </xsd:restriction>
  </xsd:simpleType>
 </xsd:element>
 <xsd:element name="ReceivedTimeStamp" type="xsd:dateTime"/>
 <xsd:element name="ReceiverMessageID" type="xsd:string"/>
 <xsd:element name="ReferenceID" type="xsd:string"/>
 <xsd:element name="SenderMessageID" type="xsd:string"/>
 <xsd:element name="SentTimeStamp" type="xsd:dateTime"/>
 <xsd:element name="Service">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Name" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Name of the business activity software service as part of a business process (e.g. AVO Interim order as part of AVO business process. CourtOutcome is a business process and an AVO final order as part of Court Outcome is a business activity)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Namespace" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>service namespace. Can define the name and version as part of the namespace also </xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Version" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>version of the business activity software service</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Context" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>arbitrary parameter which allows you to change the behaviour of this service, e.g. test, then execute a test service than a production service, specifiy the channel (e.g. internet, or thick client appln) </xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Description" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Description of the service</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Subject" type="xsd:string"/>
 <xsd:element name="SystemID" type="xsd:string"/>
 <xsd:element name="SystemType" type="xsd:string"/>
 <xsd:element name="SystemVersion" type="xsd:string"/>
 <xsd:element name="TargetSystem">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="SystemID" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Unique identifier assigned to the system</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="URL" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>URL of the target system end point</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Environment" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Type of environment (e.g. development, training, production, testing)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="SystemType" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Type of system, e.g. COPS, CIDS, CADS</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="SystemVersion" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Version number of the system (e.g. SAP 4.6.7)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="TargetSystems">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="TargetSystem" maxOccurs="unbounded">
     <xsd:annotation>
      <xsd:documentation>Details of the system</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="To">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="Name" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>Name of the receiver (e.g. DPP, AGD)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="Address" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>A URL of some sort (understood by the client and message service engine) that identifies the endpoint for a client request (and an entry point to the message service engine). The address identifies where the request is going. Used more with asynchronous messages, but can also be used to override default settings (eg. a default endpoint for a Service Bus stored in client configuration for all services). Can also be the source alias (e.g. the business system name from where the message originally was initaited, e.g. COPS)</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
    <xsd:element ref="AddressType" minOccurs="0">
     <xsd:annotation>
      <xsd:documentation>An optional type that specifies the transport type. It overrides any Transport Type information from the "address" element. The Type can also be "Source System Name"</xsd:documentation>
     </xsd:annotation>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="Type" type="xsd:string"/>
 <xsd:element name="URL" type="xsd:string"/>
 <xsd:element name="Value" type="xsd:string"/>
 <xsd:element name="Version" type="xsd:string"/>
</xsd:schema>



--  作者:JamesTeng
--  发布时间:10/4/2011 7:30:00 AM

--  
没有上传权限,所以只能把XSD代码贴出来
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
4,898.438ms