認証に使用するWebサービスを稼働させており、有効なユーザー名/パスワード<cflogin>
を提供すると、すべてが期待どおりに機能します。私が抱えている問題は、側 (クライアント) で認証が失敗した場合、サービスから返される適切なエラー メッセージではなく、大量のデータのエラー ダンプが返されることです (つまり、「ユーザー名またはパスワードが正しくありません。管理者に連絡してください」)。<cfinvoke>
ここで説明されているように、cflogin メソッドを使用して Web サービスを保護しています。
以下は CFDUMP (DUMP.Diagnostics) の抜粋です。間違ったユーザー名/and-or/パスワードを指定したときに返されます。
Cannot perform web service invocation service_name. The fault returned when invoking the web service operation is:<br> <pre>AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (401)Unauthorized faultActor: faultNode: faultDetail: {}:return code: 401 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>IIS 7.5 Detailed Error - 401.5 - Unauthorized</title> <style type="text/css"> <!-- body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;background:#CBE1EF;} code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;} .config_source code{font-size:.8em;color:#000000;} pre{margin:0;font-size:1.4em;word-wrap:break-word;} ul,ol{margin:10px 0 10px 40px;} ul.first,ol.first{margin-top:5px;} fieldset{padding:0 15px 10px 15px;} .summary-container fieldset{padding-bottom:5px;margin-top:4px;} legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;} legend... ''</pre> <br>The error occurred on line 25.
以下のスニペット(上記の記事から)と関係があると思われますが、文字列を返そうとすると「ファイルの終わりが早すぎます」というエラーが発生します。
<cfif not isAuthorized>
<!--- If the user does not pass a user name/password, return a 401 error.
The browser then prompts the user for a user name/password. --->
<cfheader statuscode="401">
<cfheader name="WWW-Authenticate" value="Basic realm=""Test""">
<cfabort>
</cfif>