cancel
Showing results for 
Search instead for 
Did you mean: 

Java Bean and WebService Import with Development Component

Former Member
0 Kudos

Hi,

currently i'm trying to import a WebService via a development componetnt (DC).

First i have imported the service into the "External Services" section. The i created a entity service and then an application service, which can be accessen from an Callable Object.

My question is:

How can i call the Entity service from within the application service??

I have a method double add(double x, double y) in the WebService, which i want to call.

I tried it this way:


//@@custom code start - add(double, double)
MyCalcAddServiceBean wsEntity = new MyCalcAddServiceBean();
QueryFilter filterX = new QueryFilter();
QueryFilter filterY = new QueryFilter();
filterX.doubleValueLow = arg0;
filterY.doubleValueLow = arg1;
List res = wsEntity.add(filterX,filterY);
	
retValue = Double.parseDouble(res.get(6).toString());
		
//@@custom code end - add(double, double)
return retValue;

but it throws an exception.

How can i call this bean correct?

Do i really need the input and output parameters as attributes of the bean?

Is it possible to call that method without this bean object?

Regards, Manuel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Manuel,

instead of the following

<code>

MyCalcAddServiceBean wsEntity = new MyCalcAddServiceBean();

</code>

do the following

<code>

EJBLocalHome localHome = HomeFactory.getInstance().getLocalHome("localejbs/sap.com/app/MyCalcAddService");

Method m = localHome.getClass().getMethod("create", new Class[]{});

MyCalcAddServiceLoca mySrv = (MyCalcAddServiceLocal)m.invoke(localHome, new Object[] {});

</code>

Best regards,

Aliaksei

Former Member
0 Kudos

Hi,

i think this is the right direction. Now i'm doing the following:

QueryFilter filterX = new QueryFilter();

QueryFilter filterY = new QueryFilter();

filterX.doubleValueLow = arg0;

filterY.doubleValueLow = arg1;

EJBLocalHome localHome = HomeFactory.getInstance().getLocalHome("localejbs/sdm.de/mycalc/MyCalcAddService");

Method m = localHome.getClass().getMethod("create", new Class[]{});

MyCalcAddServiceLocal mySrv = (MyCalcAddServiceLocal)m.invoke(localHome, new Object[] {});

List res = mySrv.add(filterX,filterY);

But i get an error when i want to invoke the Application Service through the Service Browser (caf test tools):

ERROR. No business object instance found

Calling it without the line

List res = mySrv.add(filterX,filterY);

works without error.

Does someone know why?

regards,

Manuel

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Manuel,

You need to find some tool like HttpTracer 3.x.x .

HttpTracer IP/Port - it's parameters which you configured in CAF external configuration, it can be any, for examaple your local IP/any port.

Proxy IP/ Proxy Port - target external web service ip/port, which you need to be proxied.

Also, it's really difficult to make some assumption without log. Try to change severity for according logs in visual admin and try to reproduce.

Best regards,

Aliaksei

Former Member
0 Kudos

Hi,

is it possible that i missed some prerequisites for executing the tests in the Service Browser?

Because every Entity Service i execute responds with

ERROR: No business object instance found

- My own build entity service

- the entity service from the tutorial "Integrating a WebService in a Composite Application"

- built in entity services like "Currency Converter"

none works.

i haven't found any useful information from the logs or the proxy.

I'm using the NW SneakPreview SP15, but the tutorial is marked as "works with the preview version" so i assume that it should be working.

Best Regards,

Manuel

Former Member
0 Kudos

Hi,

thx for your help so far. Because the main problem is somehow different from the original assumed problem i will post a new topic.

Best Regards

Manuel

/closed

Former Member
0 Kudos

...also, your encapsulated entiy service must work without additional extra conding. You just need to configure all correctly.

Former Member
0 Kudos

Hi Manuel,

Do you mean that your external service is encapsulated to this entity service and this entity service is not local persistent ?

In this case you need check the following:

1. Check input and output parameters mapping.

2. Check according external service configuration.

3. If both checks are ok, put the http proxy between your encapsulated service and external service. Do not forget reconfigure according service configuration. In this way you can check why call is failed.

4. If call is not performed at all you need to check the logs. It's actually the first that you need to do before these checks. An exception can make problem clear at one stroke.

Please do not create an entity instance by "New" button, I mixed it up with local persisted entities.

For tests execute your configured query in service browser - it is the most simple way. When this query will work at business entity level(MyCalcAddService), try it execute via application service(CalcApp) with mentioned implementation.

Best regards,

Aliaksei

Former Member
0 Kudos

Hi,

yes, my webservice is encapsulated to this entity service, which is not local persistent.

I also tried the tutorial "81 Integrate a Web Service in Your Composite as an External Service*" and made sure that the mappings are exactly the same as in the tutorial.

But it is the same problem. If i execute the test from the end of the tutorial the message is:

ERROR. No business object instance found

If i invoke the webservice through the WebServices Navigator at http://localhost:50000/wsnavigator/enterwsdl.html

with the same parameter values everything works fine.

1+2) should be correct

3) unfortunately i don't know how to set up this proxy. <b>Can you explain this to me in more detail?</b>

4) i checked the logs in the folder "C:\usr\sap\J2E\JC00\j2ee\cluster\server0\log" and searchedfor "Error" "Exception" "Business"

and "MyCalc". But i couldn't find any information regarding to this error. There are exceptions in the logs, but i can't see any relationship between theese and my error message or my Entity Service.

Best regards,

Manuel

Former Member
0 Kudos

Hi Manuel,

the problem is not in your coding.

Try to create business entity instance in service browser:

1. Click on Create button.

2. Then click on "Save" button.

Also check the logs for according exception(check regarding logs location).

Best regards,

Aliaksei.

Former Member
0 Kudos

Hi,

i can create new Objects, but when i hit the Save button the message

ERROR. Descriptor for method with type create for aspect add_Response not found in the service de.sdm.mycalc.appsrv.calcapp.CalcAppLocalLocalObjectImpl0

appears.

My deployed hirarchie looks like that:

sdm.de

-+ mycalc

---+ CalcApp

-


CalcApp

-


+ add_Response

-


add

---+ MyCalcAddService

-


+ MyCalcAdd

-


add

-


findByMultipleParameters

-


operation_input

and i tried the NEW > SAVE procedure on the both "CalcApp" Menus.

If i try to createa new object and save it at the MyCalcAddService.MyCalcAdd.add Menu, the error

ERROR. Error creating business object instance

occurs.

Are you sure i have to create new objects in the service browser?

I want to bind the Application Service to a Callable Object, so i can use the WebService in a CAF procedure. I don't know if then a new object is createt automatically.

best regards,

Manuel

Former Member
0 Kudos

Hi Manuel,

try the following:

QueryFilter filterX = QueryFilter.getQueryFilter(new Double(arg0)) ;

QueryFilter filterY = QueryFilter.getQueryFilter(new Double(arg1)) ;

Also provide according CAF type name for X and Y fields of your business entity.

Best regards,

Aliaksei.

Former Member
0 Kudos

Hi,

the result is the same. And if i invoke the Entity Service instead the Application Service in the Service Browser (caf test tools) the result is also

ERROR. No business object instance found

I also tried

QueryFilter filterX = QueryFilter.getQueryFilter(new Double(arg0)) ;
QueryFilter filterY = QueryFilter.getQueryFilter(new Double(arg1)) ;
MyCalcAddServiceLocal mySrv = this.getMyCalcAddService();
List res = mySrv.add(filterX,filterY);

to call the Entity Service from within the Application Service.

Who has to generate this business instance? Do i have to insert some extra code into the Entity Service? Or is it possible that i forgot some creation method inside the Entity Service?

regards,

Manuel