2011-06-23 28 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

相关问题