cancel
Showing results for 
Search instead for 
Did you mean: 

Call Client Java Proxy from Server Java Proxy

Former Member
0 Kudos

Hi Gurus!!

I'm trying to call a Client Java Proxy from a Server Java Proxy.

Is possible to do this? I think must be possible.

I have called this Client Java Proxy from another application, and run ok.

I have tried to call it following the Guide to call Java Client Proxies:

es.navantia.xi.mm.dispositivosRobotizadosKasto.MIRobotOut_PortTypeHome queryOutHome = null;

es.navantia.xi.mm.dispositivosRobotizadosKasto.MIRobotOut_PortTypeRemote queryOutRemote = null;

try {

// Get naming context

Properties p = new Properties();

p.put(

Context.INITIAL_CONTEXT_FACTORY,

"com.sap.engine.services.jndi.InitialContextFactoryImpl");

p.put(Context.PROVIDER_URL, "myurl:50104");

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

p.put(Context.SECURITY_CREDENTIALS, mypasswrod);

Context ctx = new InitialContext(p);

Object ref = ctx.lookup("RobotOut");

// Look up jndi name of proxy bean

try {

queryOutHome =

(MIRobotOut_PortTypeHome) PortableRemoteObject.narrow(

ref,

MIRobotOut_PortTypeHome.class);

} catch (Exception e) {

throw new RuntimeException(e + "1");

}

// Get Remote interface

queryOutRemote = queryOutHome.create();

} catch (Exception e) {

throw new RuntimeException(e + "2");

}

but I get this error

"com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method mIRobotIn of proxy bean $Proxy351: es.navantia.xi.mm.dispositivosRobotizadosKasto.MIRobotOut_PortTypeHome: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method mIRobotIn of proxy bean $Proxy351: es.navantia.xi.mm.dispositivosRobotizadosKasto.MIRobotOut_PortTypeHome"

es.navantia.xi.mm.dispositivosRobotizadosKasto.MIRobotOut_PortTypeHome is the corresponding PortTypeHome to the Client Java Proxy.

I have tried to call too calling directly from the server Java Proxy to the method correcponding to the Client Java Proxy. The error I get is:

"com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method mIRobotIn of proxy bean $Proxy351: es/navantia/xi/mm/dispositivosRobotizadosKasto/DTRobot_Type: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method mIRobotIn of proxy bean $Proxy351: es/navantia/xi/mm/dispositivosRobotizadosKasto/DTRobot_Type"

Tha call to the client is:

es.navantia.xi.mm.dispositivosRobotizadosKasto.MIRobotOut_PortType clase = null;

es.navantia.xi.mm.dispositivosRobotizadosKasto.DTRobot_Type client_req = null;

es.navantia.xi.mm.dispositivosRobotizadosKasto.DTRobotResponse_Type client_res = null;

client_res = clase.mIRobotOut(client_req);

Please, any help will be useful.

Thanks and regards,

Manuel Míguez.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi Stefan,

I have followed the guide you have linked but I get an error, I will try to explain it.

I get the error:

com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method mIRobotIn of proxy bean $Proxy350: es/navantia/xi/mm/dispositivosRobotizadosKasto/DTTexto_Type: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method mIRobotIn of proxy bean $Proxy350: es/navantia/xi/mm/dispositivosRobotizadosKasto/DTTexto_Type

This class es/navantia/xi/mm/dispositivosRobotizadosKasto/DTTexto_Type is the corresponding class for the input structure of thr Java Proxy Client.

Do you know what could be the cause?

Thanks and regards,

Manuel.

stefan_grube
Active Contributor
0 Kudos

Your code is wrong. Change your code according to chapter 3.14

Former Member
0 Kudos

My code now is:

import es.navantia.xi.mm.dispositivosRobotizadosKasto.DTTextoResponse_Type;

import es.navantia.xi.mm.dispositivosRobotizadosKasto.DTTexto_Type;

import es.navantia.xi.mm.dispositivosRobotizadosKasto.MITextoOut_PortTypeRemote;

import es.navantia.xi.mm.dispositivosRobotizadosKasto.MITextoOut_PortTypeHome;

....

MITextoOut_PortTypeRemote queryOutRemote = null;

MITextoOut_PortTypeHome queryOutHome = null;

DTTexto_Type Texto_type = new DTTexto_Type();

// Texto_type.setTexto(req_texto);

try {

// Get naming context

Context ctx = new InitialContext();

// Look up the EJB name in the environment

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

// Object ref = ctx.lookup("TextoOut");

// Cast to Home interface

queryOutHome = (MITextoOut_PortTypeHome)

PortableRemoteObject.narrow(ref,

MITextoOut_PortTypeHome.class);

// Get Remote interface

queryOutRemote = queryOutHome.create();

} catch (Exception e) {

System.out.println("RemoteException occurred: "+e.getMessage());

e.printStackTrace();

//return;

}

try {

queryOutRemote.$messageSpecifier();

} catch (RemoteException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

DTTextoResponse_Type Texto_response = null;

try {

Texto_response = queryOutRemote.mITextoOut(Texto_type);

} catch (SystemFaultException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (ApplicationFaultException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (RemoteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Sorry for not include it before.

I think the problem is on the link from the calling EJB to the Java proxy EJB. I have not done this point.

stefan_grube
Active Contributor
0 Kudos

As the

queryOutRemote.$messageSpecifier();

works, but the

queryOutRemote.mITextoOut(Texto_type);

not, I think you should something useful to the Texto_type.

This should not be null.

Former Member
0 Kudos

I have tested with:

DTTexto_Type Texto_type = new DTTexto_Type();

Texto_type.setTexto(req_texto);

And I get the same error.

I have linked the applications too:

On the ejb-jar.xml, I can see:

<ejb-ref>

<ejb-ref-name>ejb/MITextoOut</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<home>es.navantia.xi.mm.dispositivosRobotizadosKasto.MITextoOut_PortTypeHome</home>

<remote>es.navantia.xi.mm.dispositivosRobotizadosKasto.MITextoOut_PortTypeRemote</remote>

<ejb-link>ClientProxy.jar#MITextoOut_PortTypeBean</ejb-link>

</ejb-ref>

<ejb-local-ref>

<ejb-ref-name>ejb/MITextoOut</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<local-home>es.navantia.xi.mm.dispositivosRobotizadosKasto.MITextoOut_PortTypeLocalHome</local-home>

<local>es.navantia.xi.mm.dispositivosRobotizadosKasto.MITextoOut_PortTypeLocal</local>

<ejb-link>ClientProxy.jar#MITextoOut_PortTypeBean</ejb-link>

</ejb-local-ref>

stefan_grube
Active Contributor
0 Kudos

Have you checked the message monitor of the adapter engine, if a message has been sent out?

Former Member
0 Kudos

Hi Stefan,

I have seen on the message monitor if the adapter engine I think the message has not been sent out.

To link the ejb corresponding to the JP Client with ejb corresponding to the JP Server, I have followed the next steps:

On the ejb-jar.xml, on the source tab, I have added the source of the guide from calling the client from a j2ee apllicaction.

This is correct or is there another way for link the applications?

Thanks and regards,

Manuel.

Former Member
0 Kudos

Hi,

Now I get another error message:

com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method mIRobotIn of proxy bean $Proxy351: es/navantia/xi/mm/dispositivosRobotizadosKasto/MITextoOut_PortTypeRemote: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method mIRobotIn of proxy bean $Proxy351: es/navantia/xi/mm/dispositivosRobotizadosKasto/MITextoOut_PortTypeRemote

Now, my source is:

MITextoOut_PortTypeHome queryOutHome = null;

MITextoOut_PortTypeRemote queryOutRemote = null;

try {

// Get naming context

Context ctx = new InitialContext();

// Look up the EJB name in the environment

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

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

// Cast to Home interface

queryOutHome = (MITextoOut_PortTypeHome)

PortableRemoteObject.narrow(ref,

MITextoOut_PortTypeHome.class);

// Get Remote interface

queryOutRemote = queryOutHome.create();

} catch (Exception e) {

System.out.println("RemoteException occurred: "+e.getMessage());

e.printStackTrace();

//return;

}

try {

queryOutRemote.$messageSpecifier();

} catch (RemoteException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

DTTexto_Type Texto_type = new DTTexto_Type();

Texto_type.setTexto(req_texto);

DTTextoResponse_Type Texto_response = new DTTextoResponse_Type();

try {

Texto_response = queryOutRemote.mITextoOut(Texto_type);

} catch (SystemFaultException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (ApplicationFaultException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (RemoteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

I have tryed removing queryOutRemote.$messageSpecifier() and I get the error:

com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method mIRobotIn of proxy bean $Proxy351: es/navantia/xi/mm/dispositivosRobotizadosKasto/DTTexto_Type: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method mIRobotIn of proxy bean $Proxy351: es/navantia/xi/mm/dispositivosRobotizadosKasto/DTTexto_Type

Somebody knows what could be the cause of these errors?

Thanks and regards,

Manuel.

Former Member
0 Kudos

The problem is solved!!

I have not added the JavaProxyClient to the .ear

Answers (1)

Answers (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>I'm trying to call a Client Java Proxy from a Server Java Proxy.

>Is possible to do this? I think must be possible.

I'll just answer the first part

yes of course it's possible - this is a typical scenario actually

when we need to do something "sync" but we want to use asyn interface

with java proxies

Regards,

Michal Krawczyk