2012-02-19 1 views
0

Пожалуйста, помогите в переводе этой завиток команду команды cfx_http5перевести ротор в cfx_http5

HTTP method: PUT 
URL: http://webapi.ebayclassifieds.com/webapi/partners/{username}/ads/{ext-reference-id} 
Sample command: 

curl --digest -u{username}:{password} -v -X PUT -H 'Expect: ' -H 'Content-type: application/xml' -d @- http://webapi.ebayclassifieds.com/webapi/partners/{username}/ads/{ext-reference-id} < ad.xml 
[Note: - The "ext-reference-id"" is the unique identifier of the ad and should be used for updating and deleting the ad.] 

<CFX_HTTP5 username="myusername" password="mypassword" URL="http://webapi.ebayclassifieds.com/webapi/partners/{username}/ads/{ext-reference-id}" OUT="theresponse" METHOD="PUT"> 
+1

Cfhttp не работает для вас? – Henry

+0

cfhttp не разрешает аутентификацию дайджеста, поэтому мы используем cfx_http5 – Vlad

+0

. У меня нет подсказки об использовании тега CFX_HTTP5, однако этот человек, похоже, поделился вашей проблемой и работал вокруг, нажав java - http: //www.terrenceryan. com/blog/post.cfm/digest-authentication-in-coldfusion –

ответ

0

Вы можете вручную сделать дайджест аутентификации вместо использования http5. Возможно, вы использовали некоторые настройки и добавили дополнительные строки cfhttpparam для дополнительных заголовков, которые вам нужны:

<!--- dummy request to get nonce and domain. ---> 
<cfhttp url="http://#URLroot#/#RestOfUrl#" method="POST" > 
<cfhttpparam type="body" value=""> 
</cfhttp> 
<cfset noncestart = find('nonce="',cfhttp.Header)+7> 
<cfset nonceend = find('"',cfhttp.Header,noncestart)> 
<cfset nonce = mid(cfhttp.header,noncestart,nonceend-noncestart)> 
<cfset Realmstart = find('realm="',cfhttp.Header)+7> 
<cfset Realmend = find('"',cfhttp.Header,Realmstart)> 
<cfset Realm = mid(cfhttp.header,noncestart,nonceend-noncestart)> 
<cfset Hash1 = lcase(Hash("#user#:#Realm#:#pass#","MD5"))> 
<cfset Hash2 = lcase(Hash("POST:/#RestOfUrl#", "MD5"))> 
<cfset Response = lCase(Hash("#Hash1#:#Nonce#:#Hash2#", "MD5"))> 
<cfset Auth = 'Digest username="#user#", realm="#Realm#", nonce="#nonce#", uri="/#RestOfUrl#", response="#Response#"'> 
<!--- Real request using Auth in Header. ---> 
<cfhttp url="http://#URLroot#/#RestOfUrl#" method="POST"> 
<cfhttpparam name="Authorization" type="header" value="#Auth#"> 
<cfhttpparam type="body" value="#postValue#"> 
</cfhttp> 
+0

Спасибо Джесси Я попробую его и сообщит, если он сработает. Моя реальная проблема заключается в переводе команды cUrl. – Vlad

Смежные вопросы