2017-03-29 12 views
1

に接続しようとしたときに、私は次のコードを使用してセイバーAPIに接続しようとしています:私は次のエラーを取得していますがエラー(400)不正な要求セイバーAPI

Dim u As String = "https://developer.sabre.com/io-docs/call-api" 

' Create the web request 
request2 = DirectCast(WebRequest.Create(u), HttpWebRequest) 

' Get response 
response2 = DirectCast(request2.GetResponse(), HttpWebResponse) 

' Get the response stream into a reader 
reader2 = New StreamReader(response2.GetResponseStream()) 

' Console application output 

' MsgBox(reader.ReadToEnd()) 
Response.Write(reader.ReadToEnd()) 

を:

Server Error in '/' Application.

The remote server returned an error: (400) Bad Request.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request.

Source Error:

Line 49:
Line 50: ' Get response
Line 51: response2 = DirectCast(request2.GetResponse(), HttpWebResponse)
Line 52:
Line 53: ' Get the response stream into a reader

+0

あなたは何を達成しようとしていますか?私がURL:https://developer.sabre.com/io-docs/call-apiに行くならば。 →「私はあなたのフォーム提出に問題がありました。」 – Wisdoom

+0

私はapiを呼びたいと思うリンク私は私がapiのオンラインをテストするときに私に与えるリンクを使用 –

+0

私も試みたと同じ結果を私はまだ同じ結果を変更私はちょうどそれがない私のコードのように –

答えて

1

正しいSabre APIエンドポイントを参照していません。参考情報として.Net Saber APIコードサンプルを見ることをお勧めします。

https://github.com/SabreDevStudio/SACS-DotNet

+0

おかげで私のコードは間違っていると私はあなたがあなたのコメントのためのより簡単なコードのおかげで、なぜそれが非常に困難な理由でそれを理解していない前にそのプロジェクトを見たかと知って –

2

私は、RESTの基礎を通過することをお勧めいたします:そこhttps://developer.sabre.com/docs/rest_basics

あなたがセッションを作成する方法を、異なる環境のURLを持っている、そしてどのように、REST APIを消費するSOAPで同じ作品を開始しますAPI。

実際に各サービスを呼び出す方法は、VB.NETを使用しているように見えるため、ここでは2つのガイドがあります。 .NETとRESTサービスを使用

  1. (Microsoft.com)
    https://msdn.microsoft.com/en-us/library/jj819168.aspx

  2. C#やVBアプリケーションからのJSON Webサービスを消費(Codeproject.com)
    https://www.codeproject.com/Articles/233698/Consuming-a-Json-WebService-from-a-Csharp-or-VB-Ap

+0

ありがとう私はすでにそれを行って、 API –

関連する問題