我想獲得一個在efay api中使用coldfusion的示例。我沒有使用沙箱變量,而是使用我生成的生產變量。我在網上並沒有看到大量的CF例子,而易趣開發者網站對我來說很混亂。當我運行此示例時,出現以下錯誤:eBay API獲取結果示例不起作用
無法從URL讀取WSDL:http://www.ebay.com/webservices/latest/ebaySvc.wsdl。
我迷失在這一點上。任何幫助將不勝感激。這裏是我試圖運行下面的例子:
<!--- set some vars --->
<cfset endpoint="https://api.ebay.com/wsapi">
<cfset callName="geteBayOfficialTime">
<cfset AppID="xxx">
<cfset DevID="xxx">
<cfset CertID="xxx">
<cfset eBayAuthToken="xxx"> <!--- this is a really long string by the way --->
<cfset version="419">
<cfset routing="default">
<cfset SiteID=0>
<!--- 77 Germany, 0 USA --->
<cfscript>
// get ebay wsdl file, this could take 1 -10 minutes for the first request or after a CFMX reboot
ebayWS = CreateObject("webservice", " http://developer.ebay.com/webservices/latest/ebaySvc.wsdl");
</cfscript>
<!--- create special xml header for authentification --->
<cfset methodToCall = "GetSearchResults">
<cfsavecontent variable="ebayHeaderXML">
<cfoutput>
<ebl:RequesterCredentials xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
<ebl:eBayAuthToken>#variables.eBayAuthToken#</ebl:eBayAuthToken>
<ebl:Credentials>
<ebl:DevId>#variables.DevID#</ebl:DevId>
<ebl:AppId>#variables.AppID#</ebl:AppId>
<ebl:AuthCert>#variables.CertID#</ebl:AuthCert>
</ebl:Credentials>
</ebl:RequesterCredentials>
</cfoutput>
</cfsavecontent>
<cfset ebayXMLObj = xmlparse(ebayHeaderXML)>
<cfscript>
// set the header using addSOAPRequestHeader.. an added function to CF MX 7.0
addSOAPRequestHeader(ebayWS, "urn:ebay:apis:eBLBaseComponents", "RequesterCredentials", "#ebayXMLObj#", false);
</cfscript>
<cfscript>
// set the end point using javas _setProperty
ebayWS._setProperty("javax.xml.rpc.service.endpoint.address","https://api.ebay.com/wsapi? callname=#methodToCall#&siteid=#SiteID#&appid=#AppID#&version=#version#&Routing=#routing#") ;
// build geteBayqueryrequest..
queryrequest = StructNew();
queryrequest.query = "ipod nano";
queryrequest.version = variables.version;
queryrequest.ExpandSearch = "True";
</cfscript>
<!--- <cfscript>
queryrequest = XmlNew();
queryrequest.xmlRoot = XmlElemNew(queryrequest,"GetSearchResultsRequest");
queryrequest.GetSearchResultsRequest.XmlChildren[1] = XmlElemNew(queryrequest,"Query");
queryrequest.GetSearchResultsRequest.Query.XmlText = "ipod nano";
</cfscript>
<cfdump var=#queryrequest#>
--->
<!--- call the webservice --->
<cfinvoke webservice="#ebayWS#" method="#methodToCall#" returnvariable="thisRequest">
<cfinvokeargument name="getSearchResultsRequest" value="#queryrequest#">
</cfinvoke>
<!--- save the output //--->
<!--- <cfdump var="#thisRequest#"> --->
<cfdump var="#thisRequest.getSearchResultItemArray()#">
<cfdump var="#thisRequest.getSearchResultItemArray().getSearchResultItem()#">
<cfdump var="#thisRequest.getSearchResultItemArray().getSearchResultItem().getItem(1)#">
<cfoutput>#var#</cfoutput>
我試過那個developer.ebay.com地址,它給了我一個無法讀取URL的WSDL:http://developer.ebay.com/webservices/latest/eBaySvc.wsdl –
@JoshuaRing ebayWS = CreateObject(「webservice 「,」http://developer.ebay.com/webservices/latest/ebaySvc.wsdl「);你需要所有這些空間嗎? –