cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using ABAP webservice in a J2EE application

Former Member
0 Kudos

Hi All,

I have created a WSDL for a ECC FM.

Created a Deployable WebService Project using the WSDL. It gives a EAR and a JAR file.

Deployed the EAR generated to the server.

Then I have created a J2EE Web module

Added the JAR from the Webservice Project

and below code to call the web service

Name of the webservice proxy is getperner



//Call the webservice           
		  InitialContext ctx = new InitialContext();
		  ZgetpernerService fetch_perner =
			  (ZgetpernerService) ctx.lookup(
				  "java:comp/env/sap.com.getperner");
	
	Zgetperner port =
			  (Zgetperner) fetch_perner.getLogicalPort(
				  "ZgetPerner_Bind",
	Zgetperner.class);
		  Usr01DohrGetemployeeResponse res = port.usr01DohrGetemployee(input);
	strPerner = res.getEmployeenumber();

When I run the application it gives the below error:

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/sap.com.getperner.

I have added the Web J2EE module into an EAR project.

I have followed the approach given in below article:

[Deployable Webservice Usage in NetWeaver|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0cf9e42-ccb0-2c10-d0a4-f5aa8a79e19a?QuickLink=index&overridelayout=true]

Need help in resolving the issue.

Regards,

Sumit

Accepted Solutions (1)

Accepted Solutions (1)

former_member182374
Active Contributor
0 Kudos

Hi,

When you use "java:comp/env " you are referencing your code to an entry in web-j2ee-engine.xml file.

Do you have the correct entry in the file? (this is page 13 in the guide).

Can you publish your web-j2ee-engine.xml ?

Regards,

Omri

Former Member
0 Kudos

Hi,

JNDI Name usually, 'vendornmae/earproject/ejbbean ',

vendor name - if you create your project locally, it will be usually sap.com, if you are using NWDI, it will start with your company name.

If you have the access for visual admin you can check the correct JNDI name and specify that JNDI name during the lookup

Go to visual admin> cluster>services-->JNDI Service.

For more reference you can check this links:

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c

Hope this helps you.

Regards,

Saleem Mohammad.

Edited by: Jason Lax on Dec 28, 2011 2:38 PM (Fixed broken link)

Former Member
0 Kudos

Hi Omri,

Below is my Web-j2ee-engine-xml:

<web-j2ee-engine>

<server-component-ref>

<description>

</description>

<name>perner_proxy</name>

<type>interface</type>

<jndi-name>/wsclients/proxies/sap.com/zrfcproxy/sap.com.getperner</jndi-name>

</server-component-ref>

</web-j2ee-engine>

I am using below code for lookup:

InitialContext ctx = new InitialContext();
		  ZgetpernerService fetch_perner =
			  (ZgetpernerService) ctx.lookup(
				  "java:comp/env/zrfcproxy/sap.com.getperner");

This does not work and give the same exception meintion in my post.

Please suggest.

Regards,

Sumit

Former Member
0 Kudos

Hi Sumit,

Can you add vendor name "sap.com" after "java:comp/env"

Please try like this and check

InitialContext ctx = new InitialContext();
		  ZgetpernerService fetch_perner =
			  (ZgetpernerService) ctx.lookup(
				  "java:comp/env/sap.com/zrfcproxy/sap.com.getperner");

Regards,

Saleem Mohammad

former_member182374
Active Contributor
0 Kudos

Hi,

In order to make sure your JNDI name is correct, do the following:

1) Open Visual Administrator

2) Go to Server -> Services -> JNDI Registry

3) Drill down to wsclients -> proxies -> sap.com -> <Your Web Service> and check that it's compatible with the one in the xml file.

Regards,

Omri

Former Member
0 Kudos

Hi,

Thanks!

I checked in the VA and corrected the path.

It solved the issue.

Regards,

Sumit

Answers (0)