问题描述
|
我正在创建一个新的Web服务,其中必须使用XMLSchema严格设置数据格式。但是我找不到在Coldfusion Web服务中应用详细xml模式的方法
Web服务正在将信息作为XML进行传递,因此它们必须采用严格的格式,并且必须采用XML Schema进行修饰,以便不会传递任何错误的信息。
<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>
我进行了大量搜索,但从未找到具体的解决方案。
解决方法
这可能不是答案,但是我始终建议不要在ColdFusion中构建Web服务以接收xml文档作为参数。而是使用xml字符串作为参数,稍后您可以使用xmlParse()将其转换为xml文档。我过去有过这样的经验,后来我需要将其转换为xml字符串参数。
谢谢
普里特什