cancel
Showing results for 
Search instead for 
Did you mean: 

entity Service using external Service (Web services)

Former Member
0 Kudos

Hi, experts

I have the following problem:

one business object "Staff" uses two methods "getEmployeeByEmployeeId" and "getAllEmployees" in a web service. I have the entity Service "Staff" and define the mapping between "findById" and "getEmployeeByEmployeeId", between "findAll" and "getAllEmployees".

I have done the configuration of webservices and mapping in the CAF runtime.

The webservice runs and I get the results what I want.

But if I go to the test tool in CAF runtime and test the Entity Service Staff.

For "findById" I get the following error:

java.lang.ClassCastException: class sap.prototyp.types.Staff:prototyp~ear@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@26980fd2@alive incompatible with interface java.util.List:null

at com.sap.caf.metamodel.values.converters.QueryFilterValueConverter.convertToJava(QueryFilterValueConverter.java:213)

at com.sap.caf.rt.bol.da.remote.RemoteDataAccessService.queryWithoutBONodeAssosiations(RemoteDataAccessService.java:293)

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

at sap.prototyp.modeled.bonode.staff.staff.StaffBean.findByMultipleParameters(StaffBean.java:405)

at sap.prototyp.modeled.bonode.staff.staff.StaffBean.findById(StaffBean.java:221)

for the other I get the error:

com.sap.caf.rt.exception.CAFDataAccessException: Operation not supported.

at com.sap.caf.rt.bol.da.remote.RemoteDataAccessService.getCardinalityManyAssociationTargetKeys(RemoteDataAccessService.java:434)

at sap.prototyp.modeled.bonode.staff.staff.StaffBean.getZoneMemberStaffAssiciation(StaffBean.java:319)

I have checked for the first error: the cardinality of both is 0...1 (strange: from the webservice method I get the cardinality 1...1, and I can not change it)

For the second error...I think it seem somehow problem with the association: Can the entity service using remote Persistence have the asscociation with another business objects?

Thanks in advance fot any Hints and

Kind Regars!

Ping

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ping,

I tried to reproduce the error but I could not - it works fine here.

If you'd like you can post your project here:

https://sapmats-de.sap-ag.de/upload/index.cgi?id=HWKKWW56GOGLPLPF5DDWRCYGERBS7G8FXKJEG5I4M6JU6VROJF

I need this file:

your_app_name/metadata/src/MMR/ca_model.cafmm

I also need the WSDL and the end-point URL of the external service you are using if it is available public or the project you use to create it. If you think we cannot use this external service, just post the ca_model file anyway.

Best Regards

Pavel

Former Member
0 Kudos

Hallo experts!

Thanks!

I used CE 7.1 SP3.

The association between BO with local persistence and BO with remote persistence are not supported?

But what about the following usecase:

I have one BO "Project" with locale persistence and one BO "Employee" with remote Persistence... and I want to model the association between these 2 Objects. I think it will be n...m. So I make the new Table with "EmployeeAtProject" with both the primary Key "projectId" and "employeeId" . And after that I model the relation : between "Project" and "EmployeeAtProject" will be 1..n and the relation between "Employee" and "EmployeeAtProject" will be also 1..n... For the first one, I dont't get any exception and the second one I get the excpetion what i have posted in the first mail.

I can not understand what you mean with "Unfortunatelly this rules is enforced at runtime, but rather should have been at modeling time." I have modelled this rule in the modeling time.

Thanks in advance and

Kind Regards!

Ping

Former Member
0 Kudos

Hi Ping,

I didn't get your point. Do you have local-to-local-to-remote ?

Project(local)-EmployeeAtProject(local)-Employee(Remote)

What do you mean by creating new table? In CAF modeler you cannot do it.

For the second one you get an error exactly because we don't support local-to-remote associations. While we don't support it, we allow you to model these association via CAF modeler, and then we fail at runtime - my point was that we should disallow making of these association via the CAF modeler as long as we don't support them. Local-remote association is perfectly valid as a business case, but is not considered very common and strategic. Anyway, post like yours can make us reconsider that.

For the other issue,the one with ClassCastException, I have requested the colleaques to set up SP3 environment for me to check if we have general problem here and I will post the result here soon.

Your feedback and contribution is important.

Best Regards

Pavel

Former Member
0 Kudos

Hi, Pavel

Thanks for your answer... very helpful!

Here I try to explain somehow clear...

The Project is the business object with local persisitence and the employee is a business object with remote persistence... And I have the another business object "employeeAtProject" (with projectID, employeeID as primary key). So you are right: it is Project(local)-EmployeeAtProject(local)-Employee(Remote). At the moment I build only the relation between Project and EmployeeAtProject with 1:n. And I can not build the relation between EmployeeAtProject and Employee because of the second posted error... The problem is the following: if one employee is deleted, in our application we cannot discover the inconsistence of the data, which from my point is not nice.

Sure... the table I can not generate...it is generated by CAF...

The first error I still have it... I have mapped the method in Employee findEmployeeByEmployeeId with the webservices getEmployeeById.

And I know that the returned the value is only one, So I limited the both side with cardinality 0..1.

the whole error trace in the service browser is:

java.lang.ClassCastException: class sap.prototyp.types.Employee:sap/prototyp~ear@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@77913aa6@alive incompatible with interface java.util.List:null

at com.sap.caf.metamodel.values.converters.QueryFilterValueConverter.convertToJava(QueryFilterValueConverter.java:213)

at com.sap.caf.rt.bol.da.remote.RemoteDataAccessService.queryWithoutBONodeAssosiations(RemoteDataAccessService.java:293)

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

at sap.prototyp.modeled.bonode.employee.employee.EmployeeBean.findByMultipleParameters(EmployeeBean.java:245)

The problem occurs in the QueryFilterValueConverter...

Thanks for your answer and

Kind regards!

Ping

Former Member
0 Kudos

Hi Ping,

For the first issue:

Could you provide a little more detail about the CE release you are using.

For the second:

We don't support associations between BO Nodes with remote persistence. Unfortunatelly this rules is enforced at runtime, but rather should have been at modeling time.

Best Regards

Pavel