Skip to Content
0
Former Member
Jul 05, 2006 at 04:50 AM

Exception while connecting to r/3 through Connection Framework API

25 Views

Hi ,

This is the code that I am trying on to test connectivity to an r/3 system

package com.i3l.test;

import javax.resource.cci.MappedRecord;
import javax.resource.cci.RecordFactory;

import com.sapportals.connector.connection.IConnection;
import com.sapportals.connector.execution.functions.IInteraction;
import com.sapportals.connector.execution.functions.IInteractionSpec;
import com.sapportals.connector.execution.structures.IRecordSet;
import com.sapportals.portal.ivs.cg.ConnectionProperties;
import com.sapportals.portal.ivs.cg.IConnectorGatewayService;
import com.sapportals.portal.ivs.cg.IConnectorService;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;

public class ConnectionTest extends AbstractPortalComponent
{
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    {
		IConnection connection = null;
      try{	
      	
      IConnectorGatewayService cgService = (IConnectorGatewayService)PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
      //ConnectionProperties cp = new ConnectionProperties(request.getLocale(),request.getUser());
      connection = cgService.getConnection("KDC",request);
	  IInteraction ix = connection.createInteractionEx();
	  IInteractionSpec ixspec = ix.getInteractionSpec();
	  ixspec.setPropertyValue("Name","BAPI_SALESORDER_GETLIST");
	  RecordFactory rf = ix.getRecordFactory();
	  MappedRecord input = rf.createMappedRecord("input");
	  input.put("CUSTOMER_NUMBER", "123");
	  input.put("SALES_ORGANIZATION", "OR");
	  MappedRecord output = (MappedRecord)ix.execute(ixspec, input);
	  Object rs = null;
	  Object result = output.get("SALES_ORDERS");
	  if (result instanceof IRecordSet) {
		  rs = (IRecordSet) result;
      }
	  if (connection != null) {
		  
					connection.close();
			 
					connection = null;
				} 
	  response.write("<table><tr>");
	  response.write("<tr><td>Hello. Connected</td><td bgcolor=</td></tr>");
	  
	  response.write("</table>");

      }
      catch(Exception e)
      {
      
      }
	  
	  
	  }
	  }

I am getting the following exception .Any solutions ????

<b>Portal Runtime Error

An exception occurred while processing a request for :

iView : N/A

Component Name : N/A

com/sapportals/portal/ivs/cg/IConnectorGatewayService.

Exception id: 10:15_05/07/06_0117_3158050

See the details for the exception ID in the log file[/b