cancel
Showing results for 
Search instead for 
Did you mean: 

sender java proxy don't work

Former Member
0 Kudos

Hello!

i configured a test xi scenario: JSP->(JAVA Proxy)-> XI -> file adapter.

Jsp is in the same bean of proxy.

I deploy this j2ee application in the same j2ee of XI.

When I open jsp page with browser and send data, nothing appened.

I check also in adapter engine monitor and xml monitor but i can't see any message.

I think the problem is inside java bean because if i fix the output data, after post action i see data in jsp page.

this is the class for call proxy:

public class InvokeProxy {

public String getRole(String name, String pwd){

String role="";

UsersSyncMI_PortTypeLocalHome queryOutLocalHome=null;

UsersSyncMI_PortTypeLocal queryOutLocal=null;

try{ Context ctx = null; Object ref = null; Properties p = new Properties();

p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

p.put(Context.PROVIDER_URL, "server:50004");

p.put(Context.SECURITY_PRINCIPAL, "user");

p.put(Context.SECURITY_CREDENTIALS, "pwd");

ctx = new InitialContext();

queryOutLocalHome = (UsersSyncMI_PortTypeLocalHome)ctx.lookup("java:comp/env/ejb/UsersSyncMI_PortTypeBean");

queryOutLocal = queryOutLocalHome.create();

MessageSpecifier msg = queryOutLocal.$messageSpecifier();

msg.setSenderService("BS_XID_PROXY");

queryOutLocal.$messageSpecifier(msg);

UserDT_Type reqtype = new UserDT_Type();

reqtype.setUsername(name);

reqtype.setPassword(pwd);

UsersDBDTResponse_Type response = new UsersDBDTResponse_Type();

response = queryOutLocal.usersSyncMI(reqtype);

role = role + response.getStatementResponse().get_as_listRow().getRow(0).getRole();

} catch(Exception ex){

System.out.println(ex.getMessage()); } return role; }

.....

....

any suggestion

thanks Ale

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

Hi Alessandro,

Check in your web.xml that you have applied local refernces, as you call the localhome/localremote interfaces:

	<ejb-local-ref>
		<ejb-ref-name>ejb/MIZPROTOTIPOOUT_PortTypeBean</ejb-ref-name>
		<ejb-ref-type>Session</ejb-ref-type>
		<local-home>prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocalHome</local-home>
		<local>prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocal</local>
		<ejb-link>ejbProxyPrototype.jar#MIZPROTOTIPOOUT_PortTypeBean</ejb-link>
	</ejb-local-ref>

Or you change your code and use home and remote interfaces.

Regards

Stefan

stefan_grube
Active Contributor
0 Kudos

Hi Alessandro,

Did you apply the EJB reference in the web.xml?

Regards

Stefan

Former Member
0 Kudos

Hi Stefan!

yes, I apply.

This is my web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<display-name>WEB APP</display-name>

<description>WEB APP description</description>

<servlet>

<servlet-name>InvokeProxyPrototype.jsp</servlet-name>

<jsp-file>/InvokeProxyPrototype.jsp</jsp-file>

</servlet>

</web-app>

stefan_grube
Active Contributor
0 Kudos

Hi Alessandro,

Look here how to assign EJB reference:

/message/605488#605488 [original link is broken]

and local reference:

/message/605488#605488 [original link is broken]

In NWDI you goto web.xml tab EJB, there you can add the EJB references.

Regards

Stefan

Former Member
0 Kudos

thanks,

but when I goto web.xml tab EJB and i try to add the EJB references i receive this error:

"No reference to EJB Module Projects"

"To create EJB references, project references to EJB Module Projects are required. These projects must contains EJBs."

It's strange because the web project have reference inside a ejb module...

Former Member
0 Kudos

For this to work, right click on the web module and select Java Build Path --> Required Projects on the Build Path. This should set the dependancy of the web module onto the EJB module.

Hope this helps.

stefan_grube
Active Contributor
0 Kudos

Besides: When you are not deploying the EJB and the Web Modules with the same EAR, then you have to apply the JNDI namens in the web-j2ee-engine.xml.

Regards

Stefan

Former Member
0 Kudos

ok, thanks

Former Member
0 Kudos

My web modules is in the same ear of proxy.

I make all this step.

I try to send a test message but i don't see any message in Message Monitor or in XML monitor.

If i fix a text constant in return data i receive this data in jsp page.

I think the problem is in class InvokeProxy; the class don't call proxy.

I catch the exception:

com.sap.engine.services.jndi.persistent.UnsatisfiedReferenceImpl.

Any idea???

Message was edited by: Alessandro Pederiva

stefan_grube
Active Contributor
0 Kudos

Does the same code work when you call it from J2SE application?

Stefan

Former Member
0 Kudos

I haven't J2SE in my scenario. I can't try.

anyway, the code that i'm using now for call proxy is:

try{ Context ctx = null; Object ref = null; Properties p = new Properties();

ctx = new InitialContext();

ref = ctx.lookup("java:comp/env/ejb/MIZPROTOTIPOOUT_PortTypeBean");

queryOutLocalHome = (MIZPROTOTIPOOUT_PortTypeLocalHome)ctx.lookup("java:comp/env/ejb/MIZPROTOTIPOOUT_PortTypeBean");

queryOutLocal = queryOutLocalHome.create();

MessageSpecifier msg = queryOutLocal.$messageSpecifier();

msg.setSenderService("BS_XID_PROXY");

queryOutLocal.$messageSpecifier(msg);

DTZPROTOTIPOOUT_Type reqtype = new DTZPROTOTIPOOUT_Type();

reqtype.setData1(name);

reqtype.setData1(pwd);

DTZRETURN_Type response = new DTZRETURN_Type();

queryOutLocal.mIZPROTOTIPOOUT(reqtype);

String respons = "work!";

role = respons;

} catch(Exception ex){

System.out.println(ex.getMessage());

String error = ex.getMessage();

role = error;

}

return role; }

stefan_grube
Active Contributor
0 Kudos

Hi Alessandro,

You need only a simple Java class where you write the code to call from your NDWI. First you should test, if you can access your EJB anyway, then try the JSP approach.

Another thing you have to check: The library references of the JSP project should be the same as in the EJB project. When you use the same EAR module that should be available anyway.

In your JSP now, what is the output?

Stefan

Former Member
0 Kudos

Ciao Stefan,

I try to create a simple java class that call proxy (without jsp). But the result is the same.

At the moment my jsp output is "null".

I check the library references. there are the same .

stefan_grube
Active Contributor
0 Kudos

Hi Alessandro,

From the description of the error, I would assume that you have the proxy library classes in the EAR file. As NDWI applies them automatically, you have always to remove them with Winzip. The EAR must only contain the one jar file with the proxy classes.

Regards

Stefan

Former Member
0 Kudos

Ciao Stefan,

I remove all jar files from EAR file with winzip and deploy it again.

Now I receive a response in my jsp page.

The response is:

prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocalHome

But i think is not correct

In adapter monitor no messages are visible.

stefan_grube
Active Contributor
0 Kudos

Hi Ale,

Send me the EAR and all sources to:

stefan dot grube at sap dot com

The difficulties and Java Proxies are not the proxies itself, but you have to deal with EJB stuff which is very complicated.

Regards

Stefan

Former Member
0 Kudos

ok