TFS上のアクティブなプロジェクトに関する情報を取得するjavascriptクライアントを構築しようとしています。TFS SOAP Webサービス用のjavascriptクライアントを構築する
TFSにSOAPエンドポイントがあるので、私はwsdl2js(http://cxf.apache.org/docs/tools.html)を使ってローカルプロキシを生成し、そのプロキシで必要な機能(リストプロジェクトなど)を呼び出すことを考えていました。
function showresponse(response)
{
alert("rasp");
}
function showerror(error)
{
alert('error');
}
var test=new ClassificationSoap();
test.url="http://192.168.48.130:8080/Services/v1.0/CommonStructureService.asmx";
test.ListAllProjects(showresponse,showerror);
しかし、応答関数のどちらも呼び出されます。
は、ここに私のJSコードです。
がCommonStructureService.asmxによると、ここで要求がどのように見えるべきかです:
POST /Services/v1.0/CommonStructureService.asmx HTTP/1.1
Host: 192.168.48.130
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Classification/03/ListAllProjects"
<?xml version="1.0" encoding="utf-8"?>
<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>
<ListAllProjects xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Classification/03" />
</soap:Body>
</soap:Envelope>
私はシオマネキを解雇し、ここに私の生の要求がどのように見えるかです:
OPTIONS http://192.168.48.130:8080/Services/v1.0/CommonStructureService.asmx HTTP/1.1
Host: 192.168.48.130:8080
Connection: keep-alive
Cache-Control: max-age=0
Access-Control-Request-Method: POST
Origin: null
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30
Access-Control-Request-Headers: MessageType, SOAPAction, Content-Type
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
あなたが見ることができるように、何もありませんxmlが送信されました。
HTTP/1.1 401 Unauthorized
Content-Length: 1656
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
Date: Wed, 27 Jul 2011 17:14:08 GMT
Proxy-Support: Session-Based-Authentication
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>You are not authorized to view this page</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<STYLE type="text/css">
BODY { font: 8pt/12pt verdana }
H1 { font: 13pt/15pt verdana }
H2 { font: 8pt/12pt verdana }
A:link { color: red }
A:visited { color: maroon }
</STYLE>
</HEAD><BODY><TABLE width=500 border=0 cellspacing=10><TR><TD>
<h1>You are not authorized to view this page</h1>
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.
<hr>
<p>Please try the following:</p>
<ul>
<li>Contact the Web site administrator if you believe you should be able to view this directory or page.</li>
<li>Click the <a href="javascript:location.reload()">Refresh</a> button to try again with different credentials.</li>
</ul>
<h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.<br>Internet Information Services (IIS)</h2>
<hr>
<p>Technical Information (for support personnel)</p>
<ul>
<li>Go to <a href="http://go.microsoft.com/fwlink/?linkid=8180">Microsoft Product Support Services</a> and perform a title search for the words <b>HTTP</b> and <b>401</b>.</li>
<li>Open <b>IIS Help</b>, which is accessible in IIS Manager (inetmgr),
and search for topics titled <b>About Security</b>, <b>Authentication</b>, and <b>About Custom Error Messages</b>.</li>
</ul>
</TD></TR></TABLE></BODY></HTML>
だから、基本的にはそれが認証を必要と述べている:
はここで生の応答です。
showerror関数が呼び出されないのはなぜですか?私のクライアントは、ユーザーに資格証明を求める方法をどのように知ることができますか?
また、認証はどのように機能しますか?
は私が含まれている認証ヘッダー送信する必要が知っている:BASE64でエンコードされた「ユーザーパス」が、私は、生成Classification.jsにこのへの参照を見つけることができません
おかげ
javascriptクライアントをビルドしましたか?それはあなたが共有できるものですか? –
いいえ、私はしていません。私はWCF REST Webサービスを作成し、tfs apiを使ってtfsサーバー上のユーザーを認証する別の方法を使用しました。その後、サービスはリクエストされた情報(プロジェクト、ユーザーストーリーなど)を返してjsonsを返しました。 – Timo89