cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO: Java Client Proxy ESPXIException

0 Kudos

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:

  1. Under software component I created namespace which is same as one in WSDL of HelloEndpointService;
  2. Under namespace I created External Definition and imported WSDL HelloEndpointService;
  3. Then i created outbound synchronous service interface (stateless XI30-Compatible) and synchornous inbound service interface (stateless) with request and responses definitions from imported WSDL;
  4. In SLD I created HelloClientProxy_BS - Business System (of AS Java type) which has assigned real Java AS as technical system;
  5. In ID I created ICO which defines connection from consumer application (EJB) to external web service (HelloEndpointService😞
  • Sender: HelloClientProxy_BS (AS Java type Business system created in point 4.) and Hello_Sync_Outbound_XI (outbound XI SI created in point 3.),
  • Inbound Processing: XI_Sender (SOAP/HTTP/XI 3.0 sender Communication channel),
  • Receiver: HelloProvider (Business component created in ID to represent external web service HelloEndpointService),
  • Receiver Interface: Hello_Sync_Inbound (inbound SI created in point 3.),
  • Outbound Processing: SOAP_Receiver (SOAP/HTTP/SOAP 1.1 receiver Communication channel)

In NWDS, i did:

  1. I created EJB 3.x Session Bean and it's EAR DC;
  2. I imported WSDL/Outbound Service Interface (Hello_Sync_Outbound_XI) from ESR inside EJB DC and generated Java Client Proxy classes;
  3. I implemented wrapper class with method which has same interface as WS operation I am calling. This method doesn't do anything special - it just uses generated Java Client Proxy classes to invoke wanted operation on WS:

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.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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...


Answers (0)