我需要用XML格式编写HTTP请求到Yelp API。
GET /v2/business/yelp-san-francisco HTTP/1.1
Host: api.yelp.com
Authorization: OAuth realm="",oauth_consumer_key="xxxxxxxxxxxxxxxx",oauth_token="xxxxxxxxxxxxxxxx",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1402918725",oauth_nonce="vCTAQl",oauth_version="1.0",oauth_signature="xxxxxxxxxxxxxxxx"
Cache-Control: no-cache
Postman-Token: 338ad760-49be-df0b-a4ba-3eaa12586cd1
我该如何在XML中实现它?我尝试了以下方式:
<property name="yelp.apiUri" value="http://api.yelp.com/v2/" />
<property name="yelp.oauth.consumerKey" expression="$func:consumerKey" />
<property name="yelp.oauth.consumerKeySecret" expression="$func:consumerKeySecret" />
<property name="yelp.oauth.accessToken" expression="$func:accessToken" />
<property name="yelp.oauth.accessTokenSecret" expression="$func:accessTokenSecret" />
<property name="yelp.oauth.nonce" value="dummynonce"/>
<property name="yelp.oauth.timestamp" value="dummytimestamp"/>
<property name="Authentication" expression="fn:concat(
'OAuth realm=',
'oauth_consumer_key=', get-property('yelp.oauth.consumerKey'),
'oauth_token=', get-property('yelp.oauth.accessToken'),
'oauth_signature_method=HMAC-SHA1',
'oauth_timestamp=', get-property('yelp.oauth.timestamp'),
'oauth_nonce=', get-property('yelp.oauth.nonce'),
'oauth_version=1.0',
'oauth_signature=', get-property('yelp.oauth.accessTokenSecret')
)"/>
但是它没有起作用。