on 11-17-2008 10:34 PM
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"?>
<application-j2ee-engine xmlns:xsi="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"?>
<ejb-jar xmlns:xsi="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"?>
<ejb-j2ee-engine xmlns:xsi="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
Hi Max
Code looks ok
Did you registered to JPR using the URL
http://[hostname]:[port]/ProxyServer/register?ns=namespace&interface=interface&bean=&method=
i think the bean is not registered to JPR
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did register it
after I registered the proxy I can see 1 entry in JPR Monitor
http://Test.com/JP2SAP#SI_ConnectJP = com.test.JP2SAP.SIConnectJP_PortTypeBean:sIConnectJP
1 interfaces found
Hi,
Remove com.sap.aii.proxy.xiruntime and com.sap.aii.messaging.runtime from application-j2ee-engine.xml
The call should be:
String ctxPath = "sap.com/SI_ConnectJPEAR,interfaceName=com.Test.jPR2SAP.SIConnectJP_PortTypeHome";
just the JNDI name. You should also add user and password:
prop.put(Context.SECURITY_PRINCIPAL, "YourUser");
prop.put(Context.SECURITY_CREDENTIALS, "YourPassword");
Hope that helps
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes my business System is associated with Technical System of AS java type.
I removed com.sap.aii.proxy.xiruntime and com.sap.aii.messaging.runtime from application-j2ee-engine.xml.
added these
prop.put(Context.SECURITY_PRINCIPAL, "YourUser");
prop.put(Context.SECURITY_CREDENTIALS, "YourPassword");
Tweaked with JNDI name.But I receive the same error.
I can see the errors in Log Java trace but not in SXMB_MONI.
I performed a http://devPI:50100/ProxyServer/jprselftest. I received errors in Log java trace and also in SXMB_MONI.
Starting JPR selftest via MS with timeout 60000 msec ...
Synchronous request: SystemFaultException: Error sending MS message. Exception: XIServer:CO_TXT_OUTBINDING_ERROR:No receiver agreement found for JPR30_Selftest, JPR30_Selftest, JPR30_Selftest, JPR30_Selftest, http://sap.com/aii/proxy/xiruntime/test, JPRTestOutSync
Synchronous request for application fault: SystemFaultException: Error sending MS message. Exception: XIServer:CO_TXT_OUTBINDING_ERROR:No receiver agreement found for JPR30_Selftest, JPR30_Selftest, JPR30_Selftest, JPR30_Selftest, http://sap.com/aii/proxy/xiruntime/test, JPRTestOutSync
Synchronous request for system error: SystemFaultException: Error sending MS message. Exception: XIServer:CO_TXT_OUTBINDING_ERROR:No receiver agreement found for JPR30_Selftest, JPR30_Selftest, JPR30_Selftest, JPR30_Selftest, http://sap.com/aii/proxy/xiruntime/test, JPRTestOutSync
Done
Hello Max,
I'm having trouble to understand how will you invoke the JAVA proxy.
You mentioned that in your scenario you have Client Java proxy<>SAP PI <> RFC. My question is, how do you invoke your Client Java Proxy? JAVA API?
My scenario is the same as yours but the sender of the request is a browser which sends an HTTP GET request. This GET Request would be address to an URL that would start the client JAVA Proxy. This proxy would be
responsible of sending the message to SAP PI and getting the RFC response to be displayed in the browser.
My problem is to figure out the URL to invoke my client java proxy.
How did you invoked your client java proxy? To which URL did you addressed your request?
Can you give me a hint?
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.