cancel
Showing results for 
Search instead for 
Did you mean: 

APPLICATION SERVICE

Former Member
0 Kudos

Hi Experts,

I have created an entity service with remote persistensy..This entity service is having a method called createX which creates a record in the sql database.This entity service is working fine.Now i want to create an application service to this entity service(for createX methid).While creating an operation in the application service it is showing different types of options for operations(custom,Access,query, etc).

Which option i have to use to create an operation which uses the createX entity service operation internally.

Urgent

Thanks

Sampath.G

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sampath,

you need to use custom, since you defined your own method in Entity Service. The CRUD method have the purpose to directly map the CRUD method of the entity Service.

for the custom method you can specify all the attribute you need and in implementation tab you can call your createX method of your entity service.

hope this helps,

best regards,

Rene

Former Member
0 Kudos

Than Q Rene.I will check and let you know.

Thanks

Sampath.G

Former Member
0 Kudos

Hi Rene,

I have done same what you said.I have created an operation of custom type with the required input parameters.And in the implemntation i mapped this method to my entity service oeration createX.But when i test in service briwser i am getting the fallowing exception.

com.sap.caf.rt.exception.CAFFindException

at com.hcl.xiprcas.besrv.iprentity.IprEntityServiceBean.findByMultipleParameters(IprEntityServiceBean.java:417)

at com.hcl.xiprcas.besrv.iprentity.IprEntityServiceBean.editIPR(IprEntityServiceBean.java:329)

at com.hcl.xiprcas.besrv.iprentity.IprEntityServiceLocalLocalObjectImpl0.editIPR(IprEntityServiceLocalLocalObjectImpl0.java:918)

at com.hcl.xiprcas.appsrv.iprapplication.IprApplicationBean.editIPR(IprApplicationBean.java:146)

at com.hcl.xiprcas.appsrv.iprapplication.IprApplicationLocalLocalObjectImpl0.editIPR(IprApplicationLocalLocalObjectImpl0.java:267)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.caf.rt.services.serviceaccess.ServiceWrapper.invokeCustom(ServiceWrapper.java:373)

at com.sap.caf.rt.services.serviceaccess.CAFServiceAccessBeanImpl.invokeCustom(CAFServiceAccessBeanImpl.java:256)

at com.sap.caf.rt.services.serviceaccess.CAFServiceAccessLocalLocalObjectImpl20.invokeCustom(CAFServiceAccessLocalLocalObjectImpl20.java:925)

at com.sap.caf.rt.ui.cool.generic.AspectServiceAccess.invokeOperation(AspectServiceAccess.java:338)

at com.sap.caf.rt.ui.cool.generic.Action.execute(Action.java:135)

at com.sap.caf.ui.servicebrowser.components.visualizer.controllers.TableViewCC.executeAction(TableViewCC.java:468)

at com.sap.caf.ui.servicebrowser.components.visualizer.controllers.wdp.InternalTableViewCC.executeAction(InternalTableViewCC.java:220)

at com.sap.caf.ui.servicebrowser.components.visualizer.views.TableViewCV.onActionExecuteAction(TableViewCV.java:404)

at com.sap.caf.ui.servicebrowser.components.visualizer.views.wdp.InternalTableViewCV.wdInvokeEventHandler(InternalTableViewCV.java:376)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)

at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)

at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:711)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:665)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:232)

at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:152)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

Caused by: com.sap.caf.rt.exception.DataAccessException

at com.sap.caf.rt.bol.da.remote.RemoteDataAccessService.queryWithoutEntityRefs(RemoteDataAccessService.java:859)

at com.sap.caf.rt.bol.da.remote.RemoteDataAccessService.query(RemoteDataAccessService.java:746)

at com.hcl.xiprcas.besrv.iprentity.IprEntityServiceBean.findByMultipleParameters(IprEntityServiceBean.java:389)

... 46 more

Caused by: java.lang.NullPointerException

at com.sap.caf.rt.bol.da.remote.MessageEntityConverter.createComplexTypeValueFromFilter(MessageEntityConverter.java:387)

at com.sap.caf.rt.bol.da.remote.MessageEntityConverter.createFilterElementValue(MessageEntityConverter.java:376)

at com.sap.caf.rt.bol.da.remote.MessageEntityConverter.createComplexTypeValueFromFilters(MessageEntityConverter.java:360)

at com.sap.caf.rt.bol.da.remote.MessageEntityConverter.createElementValueFromFilters(MessageEntityConverter.java:348)

at com.sap.caf.rt.bol.da.remote.MessageEntityConverter.createInputMessagePartValueFromFilters(MessageEntityConverter.java:333)

at com.sap.caf.rt.bol.da.remote.MessageEntityConverter.createInputMessageValueFromFilters(MessageEntityConverter.java:320)

at com.sap.caf.rt.bol.da.remote.RemoteDataAccessService.queryWithoutEntityRefs(RemoteDataAccessService.java:831)

... 48 more

Can you plz tell me why this exception is coming?.

Thanks

Sampath.G

former_member4529
Active Contributor
0 Kudos

Hi,

I can't understand how get a method in the Entity Service as createX. The CRUD methods in the Entity Service are available by default which acn't be changed. The operation to create the record id create(). You can only add findBy operation sin Entity Service which you can name anything. So if you have created a custom method in Entity Service it's a findBy operation and not a create operation.

Now if you want to create the Entity Service data through an application service operation add the Entity Service as a dependent of the application service in the Dependency tab page. In the implementation write the following code:


myEntityServiceLocal myEntityService = this.getmyEntityService();

myEntity entity = myEntityService.create();

myEntity.setAttr1(attr1);
myEntity.setAttr2(attr2);

myEntityService.update(myEntity);

If you want to call the findBy method use the following code:


myEntityServiceLocal myEntityService = this.getmyEntityService();
QueryFilter qfInput = new QueryFilter(attr1);

List myEntityList = myEntityService.findByAttr1(qfInput);

Thanks,

Dipankar

Former Member
0 Kudos

But here i am using remote persistensy.Will it work?.

Thanks

Sampath.G

Former Member
0 Kudos

In the application service,which type of operation i have to create(custom or Access)?.

Former Member
0 Kudos

I am using web service as an external service.This web service is having a method called createIPR to create an IPR in the database.Now i want to create an IPR throw entity service operation which will be mapped to the webservice method createIPR.This is my problem. What i have to do now in the entity service.

Plz respond

Thanks

Sampath

former_member4529
Active Contributor
0 Kudos

Hi,

Map the default create() method of the entity service to the CreateIPR operation of the external service. Then use the code in application service to call the create() method of entity service, I mentioned in my last post.

Thanks,

Dipankar

Former Member
0 Kudos

Hi,

the CAFFindException is the typically error if you do not register your external service. So please post if you have registered our external Service in "External Service Configuration".

In general i would agree to Dipankar, but you can use it as well in your way. As long you are using input and output parameter the CAF layer do not care about the functions maintained in your web service. So use the custom method in application service. An this will work.

From the architectural view i would say that you should not, as Dipankar pointed out, use the entity service as mapping instance for a create method. Better use directly the application service to call the external service for create methods. But for findBy you can use entity service.

hope this helps,

best regards,

Rene

Former Member
0 Kudos

I mapped the default create method to Web service method createIPR.Now where in the application i vave to write the code which you have given to me.What i am asking is which type of operation i have to create in the application service?.

Thanks

Sampath.G

former_member4529
Active Contributor
0 Kudos

Hi,

You need to create a custom operation in the application service. Also you can call the external service operation directly in the application service method as mentioned by Rene.

Thanks,

Dipankar

Former Member
0 Kudos

Hi Sampath,

So Dipankar and i both think that you should use a custom method. Dipankar mentioned as well how to call the create method form application service.

But, please have a look at this:

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/297a839e-0d01-0010-e9ab-9b0299102cee">How-To-Guide CAF Core</a>

this explains a lot what we discussed in here. It is a step by step solution for a CAF Project .

hope this give you an overview about the different methods and their use.

best regards,

Rene

Answers (0)