1

cfhttpタグを使用する場合、cfhttpparamを介してbody+ヘッダーを含めます。

ColdfusionがXMLを送信する前に融合する方法が原因で、もう一方の端で構文エラーが発生します。

送信している正確なXMLを表示する、テスト用の呼び出しを指示できる一時的なCFCが必要です。

cfhttpリクエストで送信されている正確なXMLを確認するにはどうすればよいですか?

getHttpRequestData()を試しましたが、このメソッドは、探している構文ではなく構造を返します。


この質問に似たスレッドがありますが、私の特定のニーズには対応していません。 cfhttpリクエストを表示

<!--- Define Header --->
<cfsavecontent variable="soapHeader">
<cfoutput>
<soap:Header>
    <wsse:Security soap:mustUnderstand="1">
        <wsse:UsernameToken>
            <wsse:Username>MyUser</wsse:Username>
            <wsse:Password>MyPass</wsse:Password>
            <wsse:Nonce>fsdf568sf234k</wsse:Nonce> 
            <wsu:Created>2012-01-07T06:17:56Z</wsu:Created>
        </wsse:UsernameToken>
    <wsse:Security>
</soap:Header> 
</cfoutput>
</cfsavecontent>

<!--- Define Body --->
<cfsavecontent variable="soapBody">
<cfoutput>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   
    <soap:Body>
        <EmpCpsVerifyConnection xmlns="https://www.vis-dhs.com/EmployerWebService/" />
    </soap:Body>
</soap:Envelope>
</cfoutput>
</cfsavecontent>

<!--- Make SOAP Request --->
<cfhttp 
method="post"
url="https://stage.e-verify.uscis.gov/WebService/EmployerWebServiceV24.asmx?wsdl"
result="httpResponse">

<cfhttpparam
 type="header"
 name="SOAPAction"
    value="https://www.vis-dhs.com/EmployerWebService/EmpCpsVerifyConnection"
    />
<cfhttpparam
 type="header"
 name="Security"
    value="#trim( soapHeader )#"
    /> 
<cfhttpparam
type="body"
    value="#trim( soapBody )#"
    />
</cfhttp>
4

3 に答える 3

3

FiddlerWireSharkなどを使用して、データ ストリームを調べることができます。どちらも無料で、このようなデバッグに非常に役立ちます。

于 2013-01-07T17:49:06.077 に答える
0

方法 1 - xml 変数を Web ブラウザに出力します。html ソース コードを表示します。

方法 2 - xml 変数をテキストエリアに出力します。

于 2013-01-07T18:08:26.810 に答える
0

通常の CF 機構を介して SOAP メソッドを呼び出していた場合は、ファイル {cf-root}/wwwroot/WEB-INF/client-config.wsdd を編集することで完全な SOAP xml パケット ログを有効にできます。

<globalConfiguration> 要素内に次の行を追加または有効にします。

<requestFlow>
 <handler type="log"/>
</requestFlow>
<responseFlow>
 <handler type="log"/>
</responseFlow>

私のマシンでは、ログは {cf-root}/logs/cfserver.log に記録されました。

于 2014-03-12T21:28:57.730 に答える