2011-07-19 84 views
1

我有一個coldfusion web服務,它接收XML數據併發回確認。如何改變coldfusion發送肥皂響應的方式?

當有錯誤當前的代碼返回我的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文檔?

謝謝

回答

0

我認爲沒有,但你可以把整個代碼在try和catch定義自己的響應代碼。