SMP SDK 3.1 SP 04 Android基本身份验证

2020-09-07 22:16发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


您好,

谁能帮助我解决基本身份验证的问题,

详细信息:

平台:Android
SMP SDK:3.1 HF 04
以下是我在android
中用于基本身份验证的代码

克劳迪亚·帕切科

 mBaseUrl =" https://smpdev.innovapptive.com:8080/odata/applications/latest/com.innovapptive.minventory";
 HttpConversationManager mManager =新的HttpConversationManager(this);
  mManager.addFilter(new HardCodedCredentialFilter(用户名,密码)); 
mIHttpConversation = mManager.create(Uri.parse(mBaseUrl));
mIHttpConversation.setResponseListener(event-> {
Log.e(" Response ","响应代码====>" + event.getResponseStatusCode());
});
mIHttpConversation.setFlowListener(new IConversationFlowListener(){
@Overridepublic void onCancellationByRequestFilter(ICancellationEvent iCancellationEvent){< br> Log.e(LOG_TAG," onCancellationByRequestFilter =====>" + iCancellationEvent);

}

@Overridepublic void onCancellationByRequestListener(ICancellationEvent iCancellationEvent){

}

@Overridepublic void onCancellationByResponseFilter(ICancellationEvent iCancellationEvent){

Log.e(LOG_TAG," onCancellationByResponseFilter =====>" + iCancellationEvent);
}

@Overridepublic void onCommunicationError(IOException e){
Log.e(LOG_TAG," onCommunicationError =====>" + e);

}

@Overridepublic void onCompletion(){
Log.e(LOG_TAG," onCompletion =====>");
hideProgressBar();
SDKHttpHandler sdkHttpHandler = new SDKHttpHandler(MainActivity.this,mManager) ; AndroidSystem.setContext(MainActivity.this); OnlineODataProvider registrationProvider =新的OnlineODataProvider(" SmpClient",mBaseUrl); registrationProvider.getNetworkOptions()。setHttpHandler(sdkHttpHandler); registrationProvider.getServiceOptions()。setCheckVersion(false); SmpClient smpClient =新的SmpClient(registrationProvider); 连接newConnection = new Connection(); newConnection.setDeviceType(" Android"); newConnection.setAndroidGcmPushEnabled(true); newConnection.setAndroidGcmSenderId(" 453748802688"); newConnection.setAndroidGcmRegistrationId(" sgbkjsdgkjbrsgrlktlkuewitw4yi85wi853o45oiuwhvoiuhwi5y984wyv94w85u45454");
 try {smpClient.createEntity(newConnection);  } catch(Exception e){e.printStackTrace();  Snackbar.make(mainLayout,e.getMessage(),Snackbar.LENGTH_LONG).show();  }} 

@Overridepublic void onExternalCancellation(ICancellationEvent iCancellationEvent){
Log.e(LOG_TAG," onExternalCancellation =====>" + iCancellationEvent);
Snackbar.make(mainLayout,iCancellationEvent。 getResult()。toString(),Snackbar.LENGTH_LONG).show();
showAlertDialog("",iCancellationEvent.getResult()。toString());
hideProgressBar();
}

@Overridepublic void onMaxMaxumRestartsReached(ICancellationEvent iCancellationEvent){
Log.e(LOG_TAG," onMaximumRestartsReached =====>" + iCancellationEvent);
Snackbar.make(mainLayout,iCancellationEvent.getResult()。toString (),Snackbar.LENGTH_LONG).show();
showAlertDialog("",iCancellationEvent.getResult()。toString());
hideProgressBar();
}
});
> commonAuthFlowsConfigurator.configure(mManager);
commonAut hFlowsConfigurator.supportBasicAuthUsing(getProvider(用户名,密码));
commonAuthFlowsConfigurator.supportBasicAuthUsing(getChallangeProvider(用户名,密码));
mIHttpConversation.start();
请在下面找到Android日志
 2019-06-03 12:45:24.164 20643-20678/com.innovapptive.mysmp31 E/Response:响应代码====> 200
 2019-06-03 12:45:24.167 20643-20678/com.innovapptive.mysmp31 E/MyFirstProject:响应=====> <?xml version =" 1.0" encoding =" utf-8"?>   默认   端点   连接    FeatureVectorPolicies     Capabilities     
 2019-06-03 12:45:24.236 20643-20678/com.innovapptive.mysmp31 E/SAML2_SAMPLE:onCompletion =====>
 2019-06-03 12:45:24.737 20643-20648/com.innovapptive.mysmp31 I/art:做部分代码缓存收集,代码= 16KB,数据= 27KB
 2019-06-03 12:45:24.739 20643-20648/com.innovapptive.mysmp31 I/art:代码缓存收集后,代码= 16KB,数据= 27KB
 2019-06-03 12:45:24.739 20643-20648/com.innovapptive.mysmp31 I/art:将代码缓存容量增加到128KB
 2019-06-03 12:45:26.036 20643-20678/com.innovapptive.mysmp31 W/System.err:com.sap.client.odata.v4.DataServiceException:错误500(内部服务器错误)
 2019-06-03 12:45:26.036 20643-20678/com.innovapptive.mysmp31 W/System.err:{"代码":" ServerErrorException","消息":"内部服务器错误"}
 2019-06-03 12:45:26.036 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.OnlineODataProvider.errorAfterClosing(OnlineODataProvider.java:1237)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.OnlineODataProvider.createEntity(OnlineODataProvider.java:466)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.DataService.createEntity(DataService.java:475)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.DataService.createEntity(DataService.java:402)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.innovapptive.mysmp31.MainActivity $ 6.onCompletion(MainActivity.java:283)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.smp.client.httpc.HttpConversationManager $ ConversationFlow.run(HttpConversationManager.java:1265)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.smp.client.httpc.HttpConversationManager $ DelegatingRunnable.run(HttpConversationManager.java:1019)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at java.lang.Thread.run(Thread.java:761)
 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


您好,

谁能帮助我解决基本身份验证的问题,

详细信息:

平台:Android
SMP SDK:3.1 HF 04
以下是我在android
中用于基本身份验证的代码

克劳迪亚·帕切科

 mBaseUrl =" https://smpdev.innovapptive.com:8080/odata/applications/latest/com.innovapptive.minventory";
 HttpConversationManager mManager =新的HttpConversationManager(this);
  mManager.addFilter(new HardCodedCredentialFilter(用户名,密码)); 
mIHttpConversation = mManager.create(Uri.parse(mBaseUrl));
mIHttpConversation.setResponseListener(event-> {
Log.e(" Response ","响应代码====>" + event.getResponseStatusCode());
});
mIHttpConversation.setFlowListener(new IConversationFlowListener(){
@Overridepublic void onCancellationByRequestFilter(ICancellationEvent iCancellationEvent){< br> Log.e(LOG_TAG," onCancellationByRequestFilter =====>" + iCancellationEvent);

}

@Overridepublic void onCancellationByRequestListener(ICancellationEvent iCancellationEvent){

}

@Overridepublic void onCancellationByResponseFilter(ICancellationEvent iCancellationEvent){

Log.e(LOG_TAG," onCancellationByResponseFilter =====>" + iCancellationEvent);
}

@Overridepublic void onCommunicationError(IOException e){
Log.e(LOG_TAG," onCommunicationError =====>" + e);

}

@Overridepublic void onCompletion(){
Log.e(LOG_TAG," onCompletion =====>");
hideProgressBar();
SDKHttpHandler sdkHttpHandler = new SDKHttpHandler(MainActivity.this,mManager) ; AndroidSystem.setContext(MainActivity.this); OnlineODataProvider registrationProvider =新的OnlineODataProvider(" SmpClient",mBaseUrl); registrationProvider.getNetworkOptions()。setHttpHandler(sdkHttpHandler); registrationProvider.getServiceOptions()。setCheckVersion(false); SmpClient smpClient =新的SmpClient(registrationProvider); 连接newConnection = new Connection(); newConnection.setDeviceType(" Android"); newConnection.setAndroidGcmPushEnabled(true); newConnection.setAndroidGcmSenderId(" 453748802688"); newConnection.setAndroidGcmRegistrationId(" sgbkjsdgkjbrsgrlktlkuewitw4yi85wi853o45oiuwhvoiuhwi5y984wyv94w85u45454");
 try {smpClient.createEntity(newConnection);  } catch(Exception e){e.printStackTrace();  Snackbar.make(mainLayout,e.getMessage(),Snackbar.LENGTH_LONG).show();  }} 

@Overridepublic void onExternalCancellation(ICancellationEvent iCancellationEvent){
Log.e(LOG_TAG," onExternalCancellation =====>" + iCancellationEvent);
Snackbar.make(mainLayout,iCancellationEvent。 getResult()。toString(),Snackbar.LENGTH_LONG).show();
showAlertDialog("",iCancellationEvent.getResult()。toString());
hideProgressBar();
}

@Overridepublic void onMaxMaxumRestartsReached(ICancellationEvent iCancellationEvent){
Log.e(LOG_TAG," onMaximumRestartsReached =====>" + iCancellationEvent);
Snackbar.make(mainLayout,iCancellationEvent.getResult()。toString (),Snackbar.LENGTH_LONG).show();
showAlertDialog("",iCancellationEvent.getResult()。toString());
hideProgressBar();
}
});
> commonAuthFlowsConfigurator.configure(mManager);
commonAut hFlowsConfigurator.supportBasicAuthUsing(getProvider(用户名,密码));
commonAuthFlowsConfigurator.supportBasicAuthUsing(getChallangeProvider(用户名,密码));
mIHttpConversation.start();
请在下面找到Android日志
 2019-06-03 12:45:24.164 20643-20678/com.innovapptive.mysmp31 E/Response:响应代码====> 200
 2019-06-03 12:45:24.167 20643-20678/com.innovapptive.mysmp31 E/MyFirstProject:响应=====> <?xml version =" 1.0" encoding =" utf-8"?>   默认   端点   连接    FeatureVectorPolicies     Capabilities     
 2019-06-03 12:45:24.236 20643-20678/com.innovapptive.mysmp31 E/SAML2_SAMPLE:onCompletion =====>
 2019-06-03 12:45:24.737 20643-20648/com.innovapptive.mysmp31 I/art:做部分代码缓存收集,代码= 16KB,数据= 27KB
 2019-06-03 12:45:24.739 20643-20648/com.innovapptive.mysmp31 I/art:代码缓存收集后,代码= 16KB,数据= 27KB
 2019-06-03 12:45:24.739 20643-20648/com.innovapptive.mysmp31 I/art:将代码缓存容量增加到128KB
 2019-06-03 12:45:26.036 20643-20678/com.innovapptive.mysmp31 W/System.err:com.sap.client.odata.v4.DataServiceException:错误500(内部服务器错误)
 2019-06-03 12:45:26.036 20643-20678/com.innovapptive.mysmp31 W/System.err:{"代码":" ServerErrorException","消息":"内部服务器错误"}
 2019-06-03 12:45:26.036 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.OnlineODataProvider.errorAfterClosing(OnlineODataProvider.java:1237)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.OnlineODataProvider.createEntity(OnlineODataProvider.java:466)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.DataService.createEntity(DataService.java:475)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.client.odata.v4.DataService.createEntity(DataService.java:402)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.innovapptive.mysmp31.MainActivity $ 6.onCompletion(MainActivity.java:283)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.smp.client.httpc.HttpConversationManager $ ConversationFlow.run(HttpConversationManager.java:1265)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at com.sap.smp.client.httpc.HttpConversationManager $ DelegatingRunnable.run(HttpConversationManager.java:1019)
 2019-06-03 12:45:26.037 20643-20678/com.innovapptive.mysmp31 W/System.err:at java.lang.Thread.run(Thread.java:761)
 
付费偷看设置
发送
1条回答
天桥码农
1楼 · 2020-09-07 23:13.采纳回答

3.1的基本身份验证的相关文档在此处:
https://help.sap.com/doc/29b9b25ee01c42f58cb028c6e8456c7c/3.1/zh-CN/Documents/Android/HttpConversation/index.html#basic-authentication

通过查看示例,我认为有必要查看整个代码以说什么。 如果无法通过上述文档找到罪魁祸首,请打开MOB-SDK-ODP的票证并发送您的项目,以便我们进行调试。

日志输出中的SAML错误消息很奇怪。

一周热门 更多>