You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Krish chauhan (JIRA)" <ji...@apache.org> on 2014/05/05 14:11:14 UTC

[jira] [Comment Edited] (OLINGO-273) Android client works fine with Maven but gives class not found exception when working as android project

    [ https://issues.apache.org/jira/browse/OLINGO-273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13989445#comment-13989445 ] 

Krish chauhan edited comment on OLINGO-273 at 5/5/14 12:09 PM:
---------------------------------------------------------------

Thanks it really helped a lot , i am able to get the entities , i need one more favaour , i am trying to create a entity and getting 400 Bad request . Can you please provide a sample for that , below is my code which is failing.

		ODataEntity entity = ODataClientFactory.getV4().getObjectFactory().newEntity(new FullQualifiedName(
							Prefs.getInstance().namespace
							+ ".DBP_CRM_Module_BusinessObjects_Contact_Contact"));
					ODataPrimitiveValue val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildGuid(java.util.UUID.randomUUID());
					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl("Oid",val));
					

					URI uriActivityType = new URI("http://"
							+ Prefs.getInstance().domain
							+ "/DBP_CRM_Module_BusinessObjects_CreataBase");

					ODataEntityCreateRequest<ODataEntity> createRequest = ODataClientFactory.getV4().getCUDRequestFactory().getEntityCreateRequest(uriActivityType, entity);

					createRequest.setFormat(ODataPubFormat.ATOM);

					createRequest.addCustomHeader("userName", "Admin");
					createRequest.addCustomHeader("passWord", "");

					ODataEntityCreateResponse<ODataEntity> createResponse = createRequest
							.execute();

Thanx in advance...


was (Author: krish.chauhan):
Thanks it really helped a lot , i am able to get the entities , i need one more favaour , i am trying to create a entity and getting 400 Bad request . Can you please provide a sample for that , below is my code which is failing.

		ODataEntity entity = ODataClientFactory.getV4().getObjectFactory().newEntity(new FullQualifiedName(
							Prefs.getInstance().namespace
							+ ".DBP_CRM_Module_BusinessObjects_Contact_Contact"));
					ODataPrimitiveValue val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildGuid(java.util.UUID.randomUUID());
					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl("Oid",val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(firstName);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_FNAME,val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(lastName);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_LNAME,val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(officePhone);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_OFFICE_PHONE,val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(directPhone);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_DIRECT_PHONE,val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(mobilePhone);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_MOBILE,val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(email);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_EMAIL,val));
					val=  new ODataPrimitiveValueImpl.BuilderImpl(ODataServiceVersion.V40).buildString(address);					
					entity.getProperties().add(new org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl(ContactModel.CONTACT_ADDRESS1,val));

					URI uriActivityType = new URI("http://"
							+ Prefs.getInstance().domain
							+ "/DBP_CRM_Module_BusinessObjects_CreataBase");

					ODataEntityCreateRequest<ODataEntity> createRequest = ODataClientFactory.getV4().getCUDRequestFactory().getEntityCreateRequest(uriActivityType, entity);

					createRequest.setFormat(ODataPubFormat.ATOM);

					createRequest.addCustomHeader("userName", "Admin");
					createRequest.addCustomHeader("passWord", "");

					ODataEntityCreateResponse<ODataEntity> createResponse = createRequest
							.execute();

Thanx in advance...

> Android client works fine with Maven but gives class not found exception when working as android project
> --------------------------------------------------------------------------------------------------------
>
>                 Key: OLINGO-273
>                 URL: https://issues.apache.org/jira/browse/OLINGO-273
>             Project: Olingo
>          Issue Type: Question
>          Components: odata4-client
>         Environment: Android eclipse
>            Reporter: Krish chauhan
>              Labels: Android
>
> I am using odatajclient library for android and having issue with it . When i try building with maven , it works perfectly fine . But when i create an standalone android project with the help of ADT plugin, i am getting following error on device. I have added all the dependency to libs folder but did not help , also i have added all the three provided library for build path (under library but not in export)
> E/AndroidRuntime(14596): java.lang.NoClassDefFoundError: org.w3c.dom.bootstrap.DOMImplementationRegistry
> This problem occurs on devce at runtime.
> Any help in this regards, will be helpful as i have invested already 2 days on this problem.
> Thanks,
> Krish



--
This message was sent by Atlassian JIRA
(v6.2#6252)