从iPhone调用REST Web服务? [英] Call a REST webservice from iPhone?
本文介绍了从iPhone调用REST Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我 有 a REST 网络服务 使用 获取 方法 in 哪一个我通过 一个 和 结果 来自 SQL 数据库.现在 有 消费 那 网络服务 iPhone 使用 XCode . 网址 是 喜欢
http: // localhost:8732/IServices/RoleService/json/RolebyCPid/?companyId = {23834B9B-88DF-4B72-AF0B7B152E23E124}& providerId = {4257bc1a-3386-4464-9c74-0645ba1e08a4}
现在 如何 如何 此 并且 也 如何 如何 通过 参数 使用Xcode? prepan > 解决方案
问题出在您的URL:无法从iPhone访问"localhost".首先,请确保您可以从其他计算机连接到Web服务(您将需要计算机名称或IP地址,但不需要127.0.0.1).然后将您的iPhone与您的本地网络连接,然后尝试从浏览器中调用Web服务.然后使用xcode进行编码.
I have a REST webservice with Get method in which I'm passing a parameter and retrieving the results from SQL database .Now I have to consume that websevice in iPhone using XCode .My url is like
http://localhost:8732/IServices/RoleService/json/RolebyCPid/?companyId={23834B9B-88DF-4B72-AF0B7B152E23E124}&providerId={4257bc1a-3386-4464-9c74-0645ba1e08a4}
Now how to call this url and also how to pass parameters using Xcode?
解决方案 The problem lies in your URL: "localhost" is not accessible from your iPhone. First, make sure that you can connect to your webservice from other computers (you''ll need a computer name or IP address - but not 127.0.0.1). Then connect your iPhone with your local network, and try to call the webservice from the browser. Then comes your coding in xcode.
这篇关于从iPhone调用REST Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文