【问题标题】:How to change the way coldfusion send the soap response?如何改变coldfusion发送soap响应的方式?
【发布时间】:2014-08-26 01:17:39
【问题描述】:

我有一个 Coldfusion 网络服务,它接收 XML 数据并发回确认。

当出现错误时,当前代码将soap响应返回为

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:updatePendingTicketsResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://v02.intouchdataservice">
         <updatePendingTicketsReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><![CDATA[<fault>
<faultcode>TO BE DEFINED IF NEEDED</faultcode>
<faultstring >Content is not allowed in prolog.</faultstring>
<faultactor>InTouch</faultactor>
</fault>]]></updatePendingTicketsReturn>
      </ns1:updatePendingTicketsResponse>
   </soapenv:Body>
</soapenv:Envelope>

但我想要回应的是

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
  <soapenv:Fault>
<faultcode>TO BE DEFINED IF NEEDED</faultcode>
<faultstring >Content is not allowed in prolog.</faultstring>
<faultactor>InTouch</faultactor>
  </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

有没有办法改变coldfusion在出现异常时发回响应的方式?

除此之外,有没有一种方法可以将 XML 模式添加到 Coldfusion WSDL 以验证已发送的 XML 文档?

谢谢

【问题讨论】:

    标签: web-services soap coldfusion wsdl


    【解决方案1】:

    我认为没有,但您可以将整个代码放入 try and catch 中定义您自己的响应代码。

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多