zoukankan      html  css  js  c++  java
  • iOS和wikipeadia集成的技术实现

    onCreate:



    After click log in and wait for a while:


    This will trigger constructor.
    Fetch service document and meta data in constructor.


    Asynchronous task: The trigger point is in thread 1.

    onSucceed: thread 17.

    Since service document is loaded, next step is to try to load meta data. This is a state machine.

    Service Document variable:

    Now Load Metadata:

    Now metadata loaded ok:

    Metadata must be parsed with the help of service document:

    InitialListener:

    All thread lists:


    Get Customer collection list:
    And display in on UI:

    Control has moved to here:

    Get view is called:


    Click one item:

    onCreate: now create detail view:

    How does Gateway URL is fetched based on Application

    private void loadServiceDocument() throws MessagingClientException, SDMParserException {
           //progressDialog.setMessage(app.getString(R.string.load_service_doc));
                 //progressDialog.show();
                 SDMConnectivityParameters params = new SDMConnectivityParameters();
                 params.setUserName(app.getUserName());
                 params.setUserPassword(app.getUserPassword());
                 params.setBaseUrl(app.getGatewayUrl());
     
                 SDMLogger logger = new SDMLogger();
                 SDMPreferences sprefs = new SDMPreferences(app.getApplicationContext(), logger);
                
                 requestManager = new SDMRequestManager(logger, sprefs, params, 1);
                
                 parser = new SDMParser(sprefs, logger);
                 if (app.isSup()) {
                        LiteUserManager.initInstance(app.getApplicationContext(), Constants.SUP_APPLICATION_NAME);
                        LiteUserManager um = LiteUserManager.getInstance();
                        try {
     
                           LiteMessagingClient.initInstance(app.getApplicationContext(), Constants.SUP_APPLICATION_NAME);
     
                        } catch (MessagingClientException e) {
     
                              e.printStackTrace();
     
                        }
     
                        try {
     
                               LiteMessagingClient.getInstance().startClient();
     
                        } catch (MessagingClientException e) {
     
                              e.printStackTrace();
     
                        }
     
                       
                        if (um.isRegistered())
                        {
                              LiteAppSettings las = new LiteAppSettings();
                              try {
     
                                     this.serviceURL = las.getApplicationEndPoint();
                                     this.serviceURL = "http://ldcigm2.wdf.sap.corp:50018/sap/opu/sdata/sap/CUSTOMER_BRIEFING/";
                              requestManager.getConnectivityParameters().setBaseUrl(this.serviceURL);
                              requestManager.setMainHandlerClassName(SDMConstants.SDM_HTTP_HANDLER_CLASS);
                                    
                              } catch (MessagingClientException e) {
                                     e.printStackTrace();
                              }
          
                        } else {
                              //show message that the user is not registered
                        }
                 } else { // configure using gateway
                 requestManager.setMainHandlerClassName(SDMConstants.SDM_HTTP_HANDLER_CLASS);
                        this.serviceURL = "http:" + app.getGatewayUrl() + Constants.DEFAULT_APP;
                       
                 }
                
                 // update language with every request
                 String langCode = Locale.getDefault().getLanguage();
           requestManager.getConnectivityParameters().setLanguage(langCode);
                
     
                 // prepare request
                 ISDMRequest httpRequest = new SDMBaseRequest();
                
                 httpRequest.setListener(this);
                 httpRequest.setRequestUrl(this.serviceURL);
                 System.out.println("!!!!!! Service URL: " + this.serviceURL);
              httpRequest.setRequestMethod(ISDMRequest.REQUEST_METHOD_GET);
                  httpRequest.setPriority(ISDMRequest.PRIORITY_NORMAL);
                
                 requestManager.makeRequest(httpRequest);
    

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    大学生程序猿IT情书“2014爱的告白挑战赛”获奖名单及优秀情书展示系列之
    HDU 4952 Poor Mitsui(贪心)
    linux-CentOS6.4安装Memcached+memcached扩展+安装memcache扩展+Memcache+mecached同步SESSION的几种方法
    POJ 1006 Biorhythms(中国剩余定理 )
    java多线程实验 滚动字
    学习鸟哥的Linux私房菜笔记(17)——Linux引导流程
    PCI的imagework已由freeview软件代替
    小强的HTML5移动开发之路(26)—— JavaScript回顾1
    小强的HTML5移动开发之路(25)—— AppCan开发环境
    小强的HTML5移动开发之路(24)—— PhoneGap Android开发环境搭建
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/12310702.html
Copyright © 2011-2022 走看看