on 09-24-2013 3:33 PM
Hi,
I am developing an Android application using SUP 2.2 and Netweaver Gateway services. While i am trying to consume the gateway service from my code I am getting the error like below:
09-24 15:14:18.802: ERROR/ODP(317): Error: 14810 Message: Client state error. Client is initialized, but not started.
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mo.MessagingClientLib.checkClientState(MessagingClientLib.java:1604)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mo.MessagingClientLib.resumeConnection(MessagingClientLib.java:400)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.ODPClientConnection.resumeConnection(ODPClientConnection.java:649)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.SUPServerRmiCalls.makeRequest(SUPServerRmiCalls.java:190)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.SUPServerRmiCalls.makeRequest(SUPServerRmiCalls.java:377)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionFactory.makeRequest(IMOConnectionFactory.java:310)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionHandler.performRequest(IMOConnectionHandler.java:353)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionHandler.makeHttpRequest(IMOConnectionHandler.java:186)
09-24 15:14:18.802: ERROR/ODP(317): at com.sap.mobile.lib.sdmconnectivity.AbstractConnectionHandler.processRequestType(AbstractConnectionHandler.java:170)
09-24 15:14:18.802: ERROR/ODP(317): at com.sap.mobile.lib.sdmconnectivity.AbstractConnectionHandler.processRequestsFromQueue(AbstractConnectionHandler.java:130)
09-24 15:14:18.802: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionHandler.run(IMOConnectionHandler.java:103)
09-24 15:14:18.832: ERROR/ODP(317): 3rJVt3iK (com.sybase.mobile.lib.client.SUPServerRmiCalls:makeRequest:193) Error occured while reconnecting the client
09-24 15:14:18.832: ERROR/ODP(317): Error: 14810 Message: Client state error. Client is initialized, but not started.
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.ODPClientConnection.resumeConnection(ODPClientConnection.java:652)
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.SUPServerRmiCalls.makeRequest(SUPServerRmiCalls.java:190)
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.SUPServerRmiCalls.makeRequest(SUPServerRmiCalls.java:377)
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionFactory.makeRequest(IMOConnectionFactory.java:310)
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionHandler.performRequest(IMOConnectionHandler.java:353)
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionHandler.makeHttpRequest(IMOConnectionHandler.java:186)
09-24 15:14:18.832: ERROR/ODP(317): at com.sap.mobile.lib.sdmconnectivity.AbstractConnectionHandler.processRequestType(AbstractConnectionHandler.java:170)
09-24 15:14:18.832: ERROR/ODP(317): at com.sap.mobile.lib.sdmconnectivity.AbstractConnectionHandler.processRequestsFromQueue(AbstractConnectionHandler.java:130)
09-24 15:14:18.832: ERROR/ODP(317): at com.sybase.mobile.lib.client.IMOConnectionHandler.run(IMOConnectionHandler.java:103)
What could be the wrong ?
I am new to this kind of application development. Any help/suggestion will be appreciated.
Regards,
Shyam
Hi Midhun,
I have fetched the service doc and metadata doc and placed in cache. How can i pass this cache to next activity so that i make use of it to call different Netweaver Gateway collections in different activities.
Please share any example code(if any).
Regards,
Shyam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok fine. So you before fetching the metadata doc you are able to make registration of the application right. The steps you need to follow are :
SDM Initialisation (that includes setLogger();
setPreferences();
setParser();
setCache();
setParameters();
setRequestManager();
)
SUP Registration
SUP URL Retrieval
Calling Service Document
Calling MetaData Document
Finally Fetching Data.
Can you share the code that you are using to make a MetaData call. I believe that in SCCyou created the app template too.
- Midhun VP
Hi Midhun,
sorry for the late reply.
I am getting the error once again. I am able to fetch the data from the backend using the netweaver gateway services even my emulator is offline in scc.
I am using the below code. If any errors in code, please share the correct code:
try {
ODPUserManager.initInstance(this, "HR_Acc");
ODPUserManager userManager = ODPUserManager.getInstance();
if(!userManager.isUserRegistered())
{
userManager.setConnectionProfile("xx.xx.xx.xx", 5001, "0");
userManager.registerUser("HRApp", "123", true); // HRApp is the user created in SCC with activation code 123
showAlert("User Registered Successfully");
AppEndPoint = ODPAppSettings.getApplicationEndPoint();
Log.i("AppEndPoint", AppEndPoint);
}
else
{
//showAlert("User already Registered");
Toast.makeText(this, "User Already Registerd", Toast.LENGTH_SHORT).show();
//ODPUserManager userManager1 = ODPUserManager.getInstance();
}
getMetaAndServiceDoc();
private void getMetaAndServiceDoc() {
try {
ODPUserManager.initInstance(this, "HR_Acc");
AppEndPoint = ODPAppSettings.getApplicationEndPoint();
} catch (ODPException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
param = new SDMConnectivityParameters();
if (HRAcceleratorActivity.AppEndPoint.indexOf("odata") > 0)
param.enableXsrf(true);
getRequest = new SDMBaseRequest();
getRequest.setRequestUrl(AppEndPoint);
logger = new SDMLogger();
getRequest.setRequestMethod(SDMBaseRequest.REQUEST_METHOD_GET);
param.setUserName("XXXXXXXX");
param.setUserPassword("XXXXXXXXXX");
HashMap<String, String> map = new HashMap<String, String>();
map.put("Content-Type", "application/atomsvc+xml");
map.put("X-Requested-With", "XMLHttpRequest");
getRequest.setHeaders(map);
getRequest.setListener(this);
pref = new SDMPreferences(this, logger);
try {
pref.setIntPreference(
ISDMPreferences.SDM_CONNECTIVITY_CONNTIMEOUT, 7000);
parser = new SDMParser(pref, logger);
cache = new SDMCache(pref, logger);
cache.clear();
} catch (SDMPreferencesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
showAlert(e.getMessage());
} catch (SDMParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("Parser error : " + e.getMessage());
}
//get service document
reqManager = new SDMRequestManager(logger, pref, param, 1);
reqManager.makeRequest(getRequest);
synchronized (lockObject) {
try {
lockObject.wait();
} catch (InterruptedException e) {
}
}
//get schema(metadata)
String schemaURL = AppEndPoint + "$metadata";
getSchema.setRequestUrl(schemaURL);
getSchema.setRequestMethod(SDMBaseRequest.REQUEST_METHOD_GET);
HashMap<String, String> schema = new HashMap<String, String>();
schema.put("Content-Type", "application/xml");
getSchema.setHeaders(schema);
getSchema.setListener(this);
reqManager.makeRequest(getSchema);
synchronized (lockObject) {
try {
lockObject.wait();
} catch (InterruptedException e) {
}
}
}
I don't understand " I am able to fetch the data from the backend using the netweaver gateway services even my emulator is offline in scc." Are you telling that you are successfully got data from SAP to device ?
In which line of code you are getting the error in the device while debugging you can find it in the eclipse.
- Midhun VP
Use the below code to get the service document,
// Call Service Document
ISDMBundleRequest requests = new SDMBundleRequest();
ISDMRequest sdrequest = buildRequest(serviceDocPath + "/", this,
ISDMRequest.REQUEST_METHOD_GET, null);
requests.addRequest(sdrequest);
reqManager = new SDMRequestManager(logger, pref, param, 1);
reqManager.makeRequest(requests);
//serviceDocPath is the end point.
Hi Shyam,
You might have to do a startClient() call.
Regards,
Abhishek Joshi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which document you are following here ?
While debugging at which line of code the error comes?
Is the device comes online in SCC?
- Midhun VP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe that you would be doing mistake in the code. Can you have a look at the code here http://scn.sap.com/docs/DOC-8803 under Tutorial: Android OData Application Development with REST Services
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.