I am using PI 7.1, Client Java proxy<
>SAP PI <
> RFC
Here is my Client Java Proxy Class:
public String InvokeJP(String sReq)
{
String ret = "";
SIConnectJP_PortTypeHome queryOutHome;
SIConnectJP_PortTypeRemote queryOutRemote;
// check for EJB class on server
try
{
Properties prop = new Properties();
prop.put(Context.PROVIDER_URL,"devPI:50104");
prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
prop.put(Context.URL_PKG_PREFIXES, "com.sap.engine.services");
InitialContext ctx = new InitialContext(prop);
String ctxPath = "ejb:/appName=sap.com/SI_ConnectJPEAR,interfaceName=com.Test.jPR2SAP.SIConnectJP_PortTypeHome";
queryOutHome = (SIConnectJP_PortTypeHome)ctx.lookup(ctxPath);
queryOutRemote = queryOutHome.create();
} catch (Exception e) {
System.out.println("RemoteException occurred: "+e.getMessage());
e.printStackTrace();
return "<"e.toString()">";
}
// Call the Java proxy and get the return parameters
try {
// Get Remote interface
MessageSpecifier msg = queryOutRemote.$messageSpecifier();
msg.setSenderService("BS_JPR_SAP");
queryOutRemote.$messageSpecifier(msg);
//Set Request
DTReq_Type dt_req = new DTReq_Type();
dt_req.setReqPayload(sReq);
//Get Response
DTRes_Type dt_res = new DTRes_Type();
//Remote
dt_res = queryOutRemote.sIConnectJP(dt_req);
//Set Response
String sResponse = dt_res.getResPayload();
ret = sResponse;
return ret;
}
// Handle fault exception
catch (java.rmi.RemoteException e) {
System.out.println("RemoteException occurred: "+e.getMessage());
e.printStackTrace();
return "<RemoteException occurred:"e.toString()">";
}
catch (com.sap.aii.proxy.xiruntime.core.ApplicationFaultException e)
{
System.out.println("ApplicationFaultException occurred: "+e.getMessage());
e.printStackTrace();
return "<ApplicationFaultException:"e.toString()">";
}
catch (com.sap.aii.proxy.xiruntime.core.SystemFaultException e)
{
System.out.println("SystemFaultException occurred: "+e.getMessage());
e.printStackTrace();
return "<SystemFaultException:"e.toString()">";
}
catch (Exception e)
{
System.out.println("Undefined Exception occurred: "+e.getMessage());
e.printStackTrace();
return "<Undefined Exception occurred:"e.toString()">";
}
}
}
Error while invoking client Java Proxy class:
remoteLoader.properties (The system cannot find the file specified)
SystemFaultException occurred: Error sending MS message. Exception: Cannot invoke call from within a transactional context.
com.sap.aii.proxy.xiruntime.core.BaseProxyException: Error sending MS message. Exception: Cannot invoke call from within a transactional context.
at com.sap.aii.proxy.xiruntime.core.AbstractProxy.send$(AbstractProxy.java:135)
at com.Test.jPR2SAP.SIConnectJP_PortType.sIConnectJP(SIConnectJP_PortType.java:18)
at com.Test.jPR2SAP.SIConnectJP_PortTypeBean.sIConnectJP(SIConnectJP_PortTypeBean.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy2676.sIConnectJP(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:234)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
Caused by: com.sap.aii.proxy.xiruntime.core.XmlProxyException: Error sending MS message. Exception: Cannot invoke call from within a transactional context.
at com.sap.aii.proxy.xiruntime.core.XmlProxy.send(XmlProxy.java:116)
at com.sap.aii.proxy.xiruntime.core.AbstractProxy$XmlProxyHelper.send(AbstractProxy.java:157)
at com.sap.aii.proxy.xiruntime.core.AbstractProxy.send$(AbstractProxy.java:131)
... 39 more
Caused by: com.sap.aii.proxy.xiruntime.core.XmlOutboundException: Error sending MS message. Exception: Cannot invoke call from within a transactional context.
at com.sap.aii.proxy.xiruntime.core.XmlOutboundMS.send(XmlOutboundMS.java:447)
at com.sap.aii.proxy.xiruntime.core.XmlOutbound$MSSender.send(XmlOutbound.java:142)
at com.sap.aii.proxy.xiruntime.core.XmlOutbound.send(XmlOutbound.java:97)
at com.sap.aii.proxy.xiruntime.core.XmlProxy.send(XmlProxy.java:112)
... 41 more
Caused by: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Cannot invoke call from within a transactional context.
at com.sap.engine.messaging.impl.api.ConnectionImpl.call(ConnectionImpl.java:295)
at com.sap.engine.messaging.impl.api.ConnectionImpl.call(ConnectionImpl.java:383)
at com.sap.aii.proxy.xiruntime.core.XmlOutboundMS.send(XmlOutboundMS.java:428)
... 44 more
Response is: [<SystemFaultException:com.sap.aii.proxy.xiruntime.core.BaseProxyException: Error sending MS message. Exception: Cannot invoke call from within a transactional context.>]
Task Completed For Thread ID = 1
application-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8"?>
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.aii.proxy.svc</reference-target>
</reference>
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.aii.af.sdk.lib</reference-target>
</reference>
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.xi.util.misc</reference-target>
</reference>
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.guid</reference-target>
</reference>
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="library">com.sap.aii.proxy.xiruntime</reference-target>
</reference>
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="library">com.sap.aii.messaging.runtime</reference-target>
</reference>
</application-j2ee-engine>
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
http://www.w3.org/2001/XMLSchema-instance" xmlns=" http://java.sun.com/xml/ns/javaee" xmlns:ejb=" http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<description>SIConnectJP_PortTypeBean</description>
<display-name>SIConnectJP_PortTypeBean</display-name>
<enterprise-beans>
<session>
<ejb-name>com.Test.jPR2SAP.SIConnectJP_PortTypeBean</ejb-name>
<home>com.Test.jPR2SAP.SIConnectJP_PortTypeHome</home>
<remote>com.Test.jPR2SAP.SIConnectJP_PortTypeRemote</remote>
<local-home>com.Test.jPR2SAP.SIConnectJP_PortTypeLocalHome</local-home>
<local>com.Test.jPR2SAP.SIConnectJP_PortTypeLocal</local>
<ejb-class>com.Test.jPR2SAP.SIConnectJP_PortTypeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<ejb-client-jar>SIConnectJPClient.jar</ejb-client-jar>
</ejb-jar>
ejb-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8"?>
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd">
<description>SIConnectJP_PortTypeBean Java Proxy EJB</description>
<enterprise-beans>
<enterprise-bean>
<ejb-name>SIConnectJP_PortTypeBean</ejb-name>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
Please let me know how to solve this ..
Edited by: Max imus on Nov 17, 2008 11:47 PM
Edited by: Max imus on Nov 18, 2008 12:00 AM