前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >iOS和wikipeadia集成的技术实现

iOS和wikipeadia集成的技术实现

作者头像
Jerry Wang
发布2020-02-19 11:07:53
4230
发布2020-02-19 11:07:53
举报

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

代码语言:javascript
复制
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);
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-02-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • How does Gateway URL is fetched based on Application
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档