2013-06-03 2 views
1

savon을 사용하여 SOAP API와의 통합을 작성했습니다. 나는 특정 OS에만있는 것처럼 보이는 문제에 직면하고있다. 내가 말한 이유는 CentOS6과 MacOSX에서 같은 코드가 작동하지만 Ubuntu12.04에서 작동하지 않기 때문입니다. 내가 사용하는 코드는 다음과 같습니다HTTP 인증을 사용하는 Savon HTTPS 요청

@client = Savon.client do 
    wsdl "mywsdl" 
    basic_auth ["username", "password"] 
end 

@client.call(:set_session_parameters, message: {viewSettings: {rollingPeriod: "Today", shiftStart: "25200000", statisticsRange: "CurrentDay",timeZone: -21600000}}) 

오류 내가 돌아 얻을 :

[2013-06-03T18:22:31.784007 #16304] DEBUG -- : HTTPI POST request to api.five9.com (httpclient) 
I, [2013-06-03T18:22:42.413083 #16304] INFO -- : SOAP response (status 401) 
D, [2013-06-03T18:22:42.413378 #16304] DEBUG -- : <html><head><title>JBoss Web/2.1.3.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - No user credentials found</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>No user credentials found</u></p><p><b>description</b> <u>This request requires HTTP authentication (No user credentials found).</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/2.1.3.GA</h3></body></html> 
Savon::HTTPError: HTTP error (401): <html><head><title>JBoss Web/2.1.3.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - No user credentials found</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>No user credentials found</u></p><p><b>description</b> <u>This request requires HTTP authentication (No user credentials found).</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/2.1.3.GA</h3></body></html> 
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/savon-2.2.0/lib/savon/response.rb:71:in `raise_soap_and_http_errors!' 
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/savon-2.2.0/lib/savon/response.rb:13:in `initialize' 
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/savon-2.2.0/lib/savon/operation.rb:53:in `new' 
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/savon-2.2.0/lib/savon/operation.rb:53:in `call' 
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/savon-2.2.0/lib/savon/client.rb:36:in `call' 

내가 다른 OS에 코드가 잘 작동 말했듯이. Ubuntu12.04에서이 작업을 수행하기 위해 설치할 필요가있는 것이 있습니까?

정확한 복제본이 다른 OS에서 작동하는 것을 보는 것은 분명히 사용자 이름과 암호가 아닙니다.

이 문제에 대한 도움을 주시면 감사하겠습니다. 감사!

답변

1

HTTPI가 사용중인 HTTP 클라이언트에서 문제가 발생했습니다. 어떤 이유로 HTTPCLIENT가 내가 필요한 것을 위해 작동하지 않습니다. 그래서 나는 단지 gem uninstall httpclient입니다.

그 후 HTTPI는 자동으로 champ처럼 작동하는 net_http를 선택합니다!

-3

HTTP error (401)은 인증 시도가 실패했음을 의미합니다. 대개 사용자 ID/암호에 문제가 있습니다. HTML에 더 가까이서 말하면 다음과 같이 표시됩니다.

HTTP Status 401 - No user credentials found 

사용자 ID와 비밀번호가 올바른지 확인해야한다고 생각합니다.

+0

사용자 이름과 암호를 다시 확인했습니다. 또한 원격 저장소에서 두 개의 다른 OS로 가져오고 하나는 작동하고 다른 하나는이 오류를 발생시킵니다. –