on 08-27-2021 12:11 PM
Hi all,
I am trying to implement simple example of Java Client (also known as Consumer/Outbound/Sender/Inside-Out) Proxy referencing book SAP Process Orchestration - The Comprehensive Guide. The example in this book uses http://www.webservicex.net/currencyconvertor.asmx?WSDL as a target external SOAP web service but it is not available anymore. Because of that i am using even more simpler service http://www.learnwebservices.com/services/hello?WSDL which accepts name (string) and returns "Hello {name}!".
The scenario I am trying to implement looks like this:
EJB -> SAP PO -> HelloEndpointService
Following the instructions from book, i did following:
In NWDS, i did:
Wrapper class Local interface:
package com.learnwebservices.services.hello.wrapper;
import javax.ejb.Local;
import com.learnwebservices.services.hello.*;
@Local
public interface HelloSyncOutboundXIServiceBeanLocal
{
SayHelloResponseType helloSyncOutboundXI(SayHelloType request);
}
Wrapper class implementation:
package com.learnwebservices.services.hello.wrapper;
import javax.ejb.Stateless;
import javax.xml.ws.WebServiceRef;
import com.learnwebservices.services.hello.*;
/**
* Session Bean implementation class HelloSyncOutboundXIServiceBean
*/
@Stateless
public class HelloSyncOutboundXIServiceBean implements HelloSyncOutboundXIServiceBeanLocal {
// injecting reference to a web service -> name borrowed from annotation of HelloSyncOutboundXIService class (generated client proxy)
@WebServiceRef(name = "Hello_Sync_Outbound_XI_Service")
HelloSyncOutboundXIService helloService;
/**
* Default constructor.
*/
public HelloSyncOutboundXIServiceBean() {
// TODO Auto-generated constructor stub
}
@Override
public SayHelloResponseType helloSyncOutboundXI(SayHelloType request)
{
HelloSyncOutboundXI port = null;
SayHelloResponseType response = null;
try
{
port = helloService.getHello_Sync_Outbound_XI_Port();
}
catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
}
response = port.helloSyncOutboundXI(request);
return response;
}
}
After EAR/EJB deployment on server I configured service port (NW Admin -> Single Service Administration). There already was XI port generated automatically so I just added "HelloClientProxy_BS" as Sender Component value.
Now, when i try to run EJB from EJB Explorer i got following exception raised by EJB:
Errorcom.sap.engine.services.webservices.espbase.xi.exceptions.ESPXIException: Technical errors were encountered during proxy call through XI; Hint: Error while sending message. Reason: Error sending MS message. Exception: Cannot invoke call from within a transactional context.
If anybody knows what is the cause of exception I would be pretty thankful to know the answer.
Solution is to add following annotation above the EJB class:
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
Thank you adam.smith7. I found solution here: https://answers.sap.com/questions/9222001/call-synchronous-java-client-proxy-from-within-a-s.html?db...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.