- 浏览: 177762 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
yizhichao116:
大哥
设置为可编译链接
1) .m文件右键-&g ...
Windows下Object-C编译环境的搭建
客户端和服务器端的交互统一采用http get方式,如果有接口要采用 http post方式可以提出来。下面是以获取首页信息为例简单的阐述一下协议,
http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do为统一请求的URL地址,m=xxxx为你请求的服务,如果需要传递参数在后面添加,例如:
http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=get_magazine_detail&issue=316
获取杂志目录信息为例组装的url,m=get_magazine_detail表示请求获取杂志信息服务,issue=316表示要获取的第几期杂志的信息。
获取首页:
http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do为统一请求的URL地址,m=xxxx为你请求的服务,如果需要传递参数在后面添加,例如:
http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=get_magazine_detail&issue=316
获取杂志目录信息为例组装的url,m=get_magazine_detail表示请求获取杂志信息服务,issue=316表示要获取的第几期杂志的信息。
获取首页:
CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=get_total_issue HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "data": [ { "issue_title":"美女杂志1", "img": { "name":"218_issue.png", "url":"http://10.0.2.2:8080/HttpsServer/one.jpg" }, "issue_number":"2012第3期", "issue_id":"218", "type":"h3c", "pubdate":"2012年3月14日" }, { "issue_title":"美女杂志2", "img": { "name":"218_issue.png", "url":"http://10.0.2.2:8080/HttpsServer/two.jpg" }, "issue_number":"2012第3期", "issue_id":"218", "type":"h3c", "pubdate":"2012年3月14日" }, { "issue_title":"美女杂志3", "img": { "name":"218_issue.png", "url":"http://10.0.2.2:8080/HttpsServer/three.jpg" }, "issue_number":"2012第3期", "issue_id":"218", "type":"h3c", "pubdate":"2012年3月14日" }, { "issue_title":"美女杂志4", "img": { "name":"218_issue.png", "url":"http://10.0.2.2:8080/HttpsServer/four.jpg" }, "issue_number":"2012第3期", "issue_id":"218", "type":"h3c", "pubdate":"2012年3月14日" }, { "issue_title":"美女杂志5", "img": { "name":"218_issue.png", "url":"http://10.0.2.2:8080/HttpsServer/five.jpg" }, "issue_number":"2012第3期", "issue_id":"218", "type":"h3c", "pubdate":"2012年3月14日" } ] } } 获取往期杂志页: CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=get_magazine_old_datail HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "data": [ { "issue_year":"2011年度财经杂志", "type":"h3c", "magazine_old_list": [ { "issue_id":"218", "issue_number":"2012第3期", "issue_title":"铁路投融变道", "pubdate":"2012年3月14日" }, { "issue_id":"218", "issue_number":"2012第3期", "issue_title":"铁路投融变道", "pubdate":"2012年3月14日" } ] } ] } } 获取杂志目录页面: CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=get_magazine_datail&issue_id=218 HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "issue_title":"致命的集资", "issue_number":"2012第3期", "issue_id":"218", "type":"h3c", "pubdate":"2012年3月14日", "img": [ { "img_name":"218_issue.png", "img_url":"http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/218_issue.png", }, ] "magazine_list": [ { "article_type":"封面文章CoverStory" "magazine_data": [ { "article_id":"322" "article_name":"回归可持续性", "article_author":"迈克尔*斯宾赛/文" }, { "article_id":"322" "article_name":"回归可持续性", "article_author":"迈克尔*斯宾赛/文" } ] }, { "article_type":"<财经>动态CaijingTopics" "magazine_data": [ { "article_id":"322" "article_name":"回归可持续性", "article_author":"迈克尔*斯宾赛/文" }, { "article_id":"322" "article_name":"回归可持续性", "article_author":"迈克尔*斯宾赛/文" } ] } ] } } 获取调查页: CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=get_survey HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { data: [ { "survey_title":"你怎么看雷锋精神?", "survey_date":"2012年03月05日14:18", "survey_people_number":"当前共有701人参加" "survey_content":"调查问题的内容" "type":"h3c", "survey_result": [ { "result_id":"123" , "result_name":"赞同", "result_number":"282支持" }, { "result_id":"123" , "result_name":"不赞同", "result_number":"395支持" }, { "result_id":"123" , "result_name":"说不清", "result_number":"75支持" } ] }, { "survey_title":"你怎么看雷锋精神?", "survey_date":"2012年03月05日14:18", "survey_people_number":"当前共有701人参加" "survey_content":"调查问题的内容" "type":"h3c", "survey_result": [ { "result_id":"123" , "result_name":"赞同", "result_number":"282支持" }, { "result_id":"123" , "result_name":"不赞同", "result_number":"395支持" }, { "result_id":"123" , "result_name":"说不清", "result_number":"75支持" } ] } ] } } 判断是否有新杂志: CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=is_new_magazine HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "isUpdates":"0" // 0:表示没有新杂志,1:表示有新杂志更新 } } 获取文章主体内容: CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=request_article_data&issure_id=320&article_id=20 HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "brief":"摘要内容", "content":"文章内容", "imageurl": [ { "name":"致命的集资1.png", "url":"http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/218_issue1.png" }, { "name":"致命的集资2.png", "url":"http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/218_issue2.png" } ] } } 上传文章评分内容: CLIENT -> SERVER ---------------------------------------------------------------- GET GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=upload_article_grade&issure_id=320&article_id=20&grade=4 HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "response":"Thanks", } } 获取文章评论内容: CLIENT -> SERVER ---------------------------------------------------------------- GET http://xxx.xxx.xxx.xxx:xxxx/mobile_mag/api.do?m=request_article_criticism&issure_id=320&article_id=20 HTTP/1.0\r\n Host: xxx.xxx.xxx.xxx\r\n User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 \r\n Connection: Keep-Alive\r\n SERVER -> CLIENT ---------------------------------------------------------------- HTTP/1.0 200 OK\r\n Server: VanceInfoMobile_mag/1.0.00\r\n Connection: Keep-Alive\r\n Content-Type: application/json\r\n \r\n { "protocol":"Mobile_mag/1.0", "status":"200", "results": { "data": [ { "nickname":"李四", "create_time":"2012-03-15 13:00:00", "content":"很好,很强大" }, { "nickname":"张三", "create_time":"2012-03-15 12:00:00", "content":"这是什么破文章啊" } ] } }
相关推荐
本着探究 JSON 原理的目的,我将会在这DEMO中实现了一个简单的JSON解析器。由于 JSON 本身比较简单,解析起来也并不复杂。所以如果大家感兴趣的话,在看完本DEMO后,不妨自己动手实现一个 JSON 解析器。
易语言、易Json解析模块、水淼Json 易语言水淼JSON解析模块源码自主解析JSON数据类型,使用树来直观清晰显示出所有结构,辅助程序员快速定位JSON节点提高开发效率。
C#对多级json解析,非常实用,此代码写在load事件里面,然后可以了解解析json的原理。尤其是多级解析。
JSON 解析 http://blog.csdn.net/zxw136511485/article/details/51451523
自己写的json解析,不使用第三方的jar包,简单易懂,分为本地json解析和online json解析,网上的只需要修改一下url地址即可
易语言JSON解析模块2.0源码例程程序结合易语言扩展界面支持库和应用接口支持库,调用API函数实现JSON解析、生成、编辑。点评:易语言JSON解析模块2.0源码通过封装JSON类形成稳定强大的json处理核心。资源作者:。...
sql server 2014 JSON解析到表函数 CREATE FUNCTION [dbo].[parseJSON]( @JSON NVARCHAR(MAX)) RETURNS @hierarchy TABLE ( element_id INT IDENTITY(1, 1) NOT NULL, ...
PB调用http api接口,PB解析json到数据源,get和post都有案列,PB解析json,可解析树立菜单,也完美可解析后将结果存到数据源
Json解析,Gson解析,本地,网络解析简单的案例
c# json 解析+C# newtonsoft.json.dll 解析类库文件。
Unity能够在WebGL包使用的json解析.dll
一个json库, 用于c程序中解析json格式
易语言页面订单json解析源码,页面订单json解析,初始化表格,从网页源码中读取订单到数组,将订单数组内容写到表格
这是一款windows版绿色的离线json解析工具,还在担心json格式化吗?简单易用。完全绿色,不需要安装。离线即可将json数据进行格式化。且自动去除数据中字段为null的字段
PB Json解析库
添加一个命令行参数-pretty,对于文件*.json,如果解析成功, 那么将格式化后的json 输出到另一个文件*.pretty.json 中; 对于任意的json 文本和一个给定的查询路径,可以查找到指定的值,并能给出这个值 的类型...
JSON解析最新版20151017超简JSON效验解析器
四种JSON解析包,用于JSON解析。里面还有一个Demo。
c#解析带数组的json,采用Newtonsoft.Json。资源是VS2013创建的工程。适合新手使用,老鸟就自己钻研解析哦~
最简单最高效的Json解析,快捷小巧方便简洁