0
我在Appcelerator Titanium中的HTTPClient存在問題。 我使用它的GET請求到以下端點:與鈦Titanium HTTPClient不會返回完整響應
{
"nlmDisclaimer":"It is not the intention of NLM to provide specific medical advice, but rather to provide users with information to better understand their health and their medications. NLM urges you to consult with a qualified physician for advice about medications.",
"userInput":{
"sources":[
""
],
"rxcuis":[
"5640",
"53694"
]
},
"fullInteractionTypeGroup":[
{
"sourceDisclaimer":"DrugBank is intended for educational and scientific research purposes only and you expressly acknowledge and agree that use of DrugBank is at your sole risk. The accuracy of DrugBank information is not guaranteed and reliance on DrugBank shall be at your sole risk. DrugBank is not intended as a substitute for professional medical advice, diagnosis or treatment..[www.drugbank.ca]",
"sourceName":"DrugBank",
"fullInteractionType":[
{
"comment":"Drug1 (rxcui = 53694, name = nimesulide, tty = IN). Drug2 (rxcui = 5640, name = Ibuprofen, tty = IN). Drug1 is resolved to nimesulide, Drug2 is resolved to Ibuprofen and interaction asserted in DrugBank between Nimesulide and Ibuprofen.",
"minConcept":[
{
"rxcui":"53694",
"name":"nimesulide",
"tty":"IN"
},
{
"rxcui":"5640",
"name":"Ibuprofen",
"tty":"IN"
}
],
"interactionPair":[
{
"interactionConcept":[
{
"minConceptItem":{
"rxcui":"53694",
"name":"nimesulide",
"tty":"IN"
},
"sourceConceptItem":{
"id":"DB04743",
"name":"Nimesulide",
"url":"http://www.drugbank.ca/drugs/DB04743#interactions"
}
},
{
"minConceptItem":{
"rxcui":"5640",
"name":"Ibuprofen",
"tty":"IN"
},
"sourceConceptItem":{
"id":"DB01050",
"name":"Ibuprofen",
"url":"http://www.drugbank.ca/drugs/DB01050#interactions"
}
}
],
"severity":"N/A",
"description":"The risk or severity of adverse effects can be increased when Ibuprofen is combined with Nimesulide."
}
]
}
]
}
]
}
相反了HTTPClient我只得到這樣的迴應:
https://rxnav.nlm.nih.gov/REST/interaction/list.json?rxcuis=5640+53694
應該返回這樣的響應
{
"nlmDisclaimer":"It is not the intention of NLM to provide specific medical advice, but rather to provide users with information to better understand their health and their medications. NLM urges you to consult with a qualified physician for advice about medications.",
"userInput":{
"sources":[
""
],
"rxcuis":[
"5640+53694"
]
}
}
進行請求的代碼如下:
var client = Ti.Network.createHTTPClient({
onload: function() {
console.log(this.responseText);
var json = JSON.parse(this.responseText);
console.log(json);
},
onerror: function() {
console.log(this.responseText);
}
});
var url = "https://rxnav.nlm.nih.gov/REST/interaction/list.json?rxcuis=5640+53694";
client.open("GET", url);
client.setRequestHeader("Accept", "application/json");
client.send();
我也試着返回xml而不是json,但是它是一樣的,只返回響應的第一部分。有關如何解決此問題的任何線索?
我現在用的是5.2.0,可能是問題,你更新你的問題SDK版本,合金版本,項目目標等?是的,我試圖記錄json的所有內容。現在我已經解決了使用另一種定製的Web服務,它將返回鈦客戶端的完整響應。 – revy
然後,也許這是與Web服務的東西。你可以嘗試SDK 6.0.1還是在iOS上運行你的應用程序? –