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 NoTitle 不显示标题
  6. 自定义ActionBar标题与菜单中的文字样式
  7. Android中全屏或者取消标题栏

随机推荐

  1. android控件之EditText
  2. android webview夜间模式javascript代码
  3. Android SQLite数据库存储实现
  4. Android之Intent和常用Action
  5. Android调用系统自带的文件管理器进行文
  6. Android中使用Bezier曲线
  7. android编译错误--/usr/bin/ld: cannot f
  8. Android 学习 之 TextView结合SpannableS
  9. android 浮动在activity 上的button
  10. Android 截图程序实现 需要root权限