on 12-09-2008 6:51 PM
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.
Check this guide, chapter 3.14:
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
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>
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.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.