2017-03-29 4 views
1

:오류 (400) 잘못된 요청 나는 다음과 같은 코드를 사용하여 세이버 API 연결을 시도하고

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

: 나는 다음과 같은 오류를 얻고있다 그러나

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()) 

+0

성취하려는 것을 공유 할 수 있습니까? URL (https://developer.sabre.com/io-docs/call-api)로 이동하면됩니다. -> 다음과 같이 표시됩니다. "양식을 제출할 때 문제가 발생했습니다." – Wisdoom

+0

나는 api를 호출하기를 원한다. 나는 API를 온라인으로 테스트했을 때 나에게주는 링크를 사용했다. –

+0

또한 내 코드를 변경 했는데도 여전히 같은 결과를 보였다. 단지 api를 호출하는 방법을 원한다. 내 코드가 –

답변

1

올바른 Sabre API 끝점을 참조하지 않습니다. 참조 정보를 보려면 .Net Saber API 코드 샘플을 살펴 보는 것이 좋습니다.

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

+0

덕분에 내가 내 코드가 잘못되었다는 것을 알았고 그 프로젝트를 보지 못했다. 왜냐하면 그 어려운 이유는 내가 당신의 코멘트에 대해 더 간단한 코드를 필요로하기 때문이다. –

2

나는 당신이 REST의 기본을 통과하는 것이 좋습니다 : https://developer.sabre.com/docs/rest_basics

당신은 다른 환경 URL을 SOAP를 들어, REST API를 세션을 만들려면 어떻게 소모 시작하는 방법, 같은 작품을 아피스.

각 서비스를 실제로 호출하는 방법은 언어에 따라 다릅니다. 여기서는 VB.NET을 사용하고있는 것으로 보이므로 내가 찾은 2 가지 가이드가 있습니다. .NET과 REST 서비스를 사용

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

  2. 는 C# 또는 VB 응용 프로그램에서 JSON WebService를 소비 (Codeproject.com)
    https://www.codeproject.com/Articles/233698/Consuming-a-Json-WebService-from-a-Csharp-or-VB-Ap

+0

덕분에 이미 그것을했고 성공적으로 API –