String uri = "http://192.168.24.117/ProductService.svc/GetArticleList";        DefaultHttpClient client=new DefaultHttpClient();                HttpPost requst=new HttpPost(uri);        requst.setHeader("Accept", "application/json");        requst.addHeader("Content-Type", "application/json; charset=utf-8");                try {HttpResponse responsepost = client.execute(requst); if(responsepost.getStatusLine().getStatusCode()==200){ String response=EntityUtils.toString(responsepost.getEntity());  JSONObject jsonObject=new JSONObject(response);  JSONArray arr = new JSONArray(jsonObject.getString("Data"));  for(int i=0;i<arr.length();i++){ JSONObject item = (JSONObject) arr.get(i);    Log.i(TAG,item.getString("Title")); } Log.i(TAG,jsonObject.getString("Data"));  }} catch (ClientProtocolException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (JSONException e) {// TODO Auto-generated catch blocke.printStackTrace();}

btnArticle.setOnClickListener(new OnClickListener(){@Overridepublic void onClick(View arg0) {String uri = "http://192.168.24.117/AppService.svc/GetArticleDetails";        DefaultHttpClient client=new DefaultHttpClient();                HttpPost requst=new HttpPost(uri);        requst.setHeader("Accept", "application/json");        requst.addHeader("Content-Type", "application/json; charset=utf-8");                JSONObject jsonParams=new JSONObject();         try {                jsonParams.put("sysNo","1");                                HttpEntity bodyEntity=new StringEntity(jsonParams.toString(),"utf8");                requst.setEntity(bodyEntity);                HttpResponse responsepost = client.execute(requst);                 if(responsepost.getStatusLine().getStatusCode()==200){ String response=EntityUtils.toString(responsepost.getEntity());  JSONObject jsonObject=new JSONObject(response);   JSONObject jsonData=new JSONObject(jsonObject.getString("Data"));  //Log.i(TAG,response); //Log.i(TAG,jsonObject.getString("Data"));  Log.i(TAG,"编号:"+jsonData.getString("SysNo") +"    标题:"+jsonData.getString("Title"));   }} catch (ClientProtocolException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (JSONException e) {// TODO Auto-generated catch blocke.printStackTrace();}}});

  <!--wcf begin-->    <system.serviceModel>      <bindings>        <basicHttpBinding>          <binding name="ServiceProxyBinding" sendTimeout="00:10:00" receiveTimeout="00:10:00" closeTimeout="00:10:00" maxBufferSize="2147483647"           maxBufferPoolSize="2147483647"           maxReceivedMessageSize="2147483647" >            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"                          maxArrayLength="2147483647" maxBytesPerRead="2147483647"                          maxNameTableCharCount="2147483647" />          </binding>          <binding name="LargeSettings" maxBufferPoolSize="2147483647"            maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"              maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />            <security mode="None" />          </binding>          <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647"            maxReceivedMessageSize="2147483647">            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"              maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />            <security mode="None" />          </binding>        </basicHttpBinding>        <webHttpBinding>          <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647"            maxReceivedMessageSize="2147483647" transferMode="Streamed">            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"              maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          </binding>        </webHttpBinding>      </bindings>      <!--services-->      <services>        <service name="Pisen.Service.Impl.ProductService" behaviorConfiguration="ProductServiceBehavior">          <endpoint address="" binding="webHttpBinding" contract="Pisen.Service.Contract.IProductService" behaviorConfiguration="web" />        </service>        <service name="Pisen.Service.Impl.AppService" behaviorConfiguration="AppServiceBehavior">          <endpoint address="" binding="webHttpBinding" contract="Pisen.Service.Contract.IAppService" behaviorConfiguration="web" />        </service>      </services>      <!--behaviors-->      <behaviors>          <endpointBehaviors>            <behavior name="web">              <webHttp helpEnabled="true" />              <dataContractSerializer maxItemsInObjectGraph="2147483647" />            </behavior>          </endpointBehaviors>          <serviceBehaviors>            <behavior name="ProductServiceBehavior">              <dataContractSerializer maxItemsInObjectGraph="2147483647" />              <serviceMetadata httpGetEnabled="true" />              <serviceDebug includeExceptionDetailInFaults="true" />            </behavior>            <behavior name="AppServiceBehavior">              <dataContractSerializer maxItemsInObjectGraph="2147483647" />              <serviceMetadata httpGetEnabled="true" />              <serviceDebug includeExceptionDetailInFaults="true" />            </behavior>            <behavior name="">                <serviceMetadata httpGetEnabled="true" />                <serviceDebug includeExceptionDetailInFaults="false" />            </behavior>          </serviceBehaviors>      </behaviors>      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />          </system.serviceModel>  <!--wcf end-->

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

更多相关文章

  1. 四极管:Android标题栏各种设置
  2. android 去除 标题和状态栏
  3. android 隐藏标题栏
  4. android中去掉标题栏和状态栏
  5. Android之自定义标题栏(组合控件)
  6. Android中全屏无标题设置
  7. android dialog使用小结
  8. Android(安卓)去掉窗口标题和程序全屏
  9. android一种较为复杂的布局参考(xml文件)

随机推荐

  1. Android视音频录制实现步骤(Android学习随
  2. android WindowManager可拖动悬浮按钮
  3. [Android] Handler源码解析 (Java层)
  4. Android开发之fedora13下编译Android源码
  5. Android(安卓)mac 真机调试
  6. Android(安卓)设备监听网络状态变化
  7. Android(安卓)查询字段
  8. Android(安卓)-- 加载大图片的方法
  9. Android(安卓)UI结构源码研究
  10. Android(安卓)uevent架构