2011-06-23 43 views
2

我正在創建一個新的Web服務,其中數據格式應該嚴格使用XMLSchema。但我不能找到一種方法ColdFusion的Web服務如何將XML模式添加到Coldfusion Web服務

Web服務是傳遞信息的XML應用細節XML架構和他們需要在前人的精力在XML模式spedicied嚴格的格式,這樣就沒有錯信息通過。

<wsdl:types> 
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
     <xs:element name="UpdatePendingTicketsRequest"> 
      <xs:complexType> 
       <xs:sequence> 
        <xs:element ref="SIMS_REPLY_NAVISION_TO_INTOUCH"> 
     </xs:element> 
       </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element name="UpdatePendingTicketsResponse"> 
     <xs:simpleType>    
      <xs:restriction base="xs:string"> 
       <xs:enumeration value="OK"/> 
       <xs:enumeration value="ERROR_PROCESSING"/> 
      </xs:restriction> 
     </xs:simpleType> 
     </xs:element> 
     <xs:simpleType name="ST_STATUS"> 
      <xs:restriction base="xs:integer"> 
       <xs:enumeration value="1"/> 
       <xs:enumeration value="2"/> 
       <xs:enumeration value="99"/> 
      </xs:restriction> 
     </xs:simpleType> 
     <xs:element name="TRANSACTIONS"> 
      <xs:complexType> 
       <xs:sequence> 
        <xs:element ref="TRANSACTION" maxOccurs="unbounded"/> 
       </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element name="TRANSACTION"> 
      <xs:complexType> 
       <xs:sequence> 
        <xs:element ref="ORIGINAL_TRANSACTION_ID"/> 
        <xs:element ref="STATUS"/> 
       </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element name="STATUS"> 
      <xs:complexType> 
       <xs:simpleContent> 
        <xs:extension base="ST_STATUS"> 
         <xs:attribute name="description" use="required"> 
          <xs:simpleType> 
           <xs:restriction base="xs:string"> 
            <xs:enumeration value="DUPLICATE"/> 
            <xs:enumeration value="OK"/> 
            <xs:enumeration value="PROBLEM"/> 
           </xs:restriction> 
          </xs:simpleType> 
         </xs:attribute> 
        </xs:extension> 
       </xs:simpleContent> 
      </xs:complexType> 
     </xs:element> 
     <xs:element name="SIMS_REPLY_NAVISION_TO_INTOUCH"> 
      <xs:complexType> 
       <xs:sequence> 
        <xs:element ref="DATETIME"/> 
        <xs:element ref="TRANSACTIONS"/> 
       </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element name="ORIGINAL_TRANSACTION_ID" type="xs:string"/> 
     <xs:element name="DATETIME" type="xs:dateTime"/> 
     <xs:element name="FaultStructure"> 
     <xs:complexType > 
      <xs:sequence> 
       <xs:element type="xs:string" name="FaultCode"/> 
       <xs:element type="xs:string" name="FaultString"/> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
    </xs:schema> 
</wsdl:types> 

這是用於驗證有效負載的XML示例示例。但是當我在Coldfusion中創建相同的時候,這就是我所得到的。

<wsdl:types> 
    <schema targetNamespace="http://rpc.xml.coldfusion" xmlns="http://www.w3.org/2001/XMLSchema"> 
    <import namespace="http://xml.apache.org/xml-soap"/> 
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> 
    <complexType name="CFCInvocationException"> 
    <sequence/> 
    </complexType> 
    </schema> 
</wsdl:types> 

我做了很多搜索,沒有找到具體的解決方案。

回答

1

這可能不是答案,但我始終建議不要在ColdFusion中構建webservice以接收xml文檔作爲參數。而是使用xml字符串作爲參數,以後可以使用xmlParse()將其轉換爲xml文檔。過去和現在我都有過這樣的經驗,我需要將它轉換爲xml字符串參數。

謝謝 Pritesh

相關問題