Sample JAVA code using Resource Adapter for RFC Connections

Hi Java Knowledgeable Ones.
I have successfully deployed the SAP Netweaver J2ee Engine "Resource Adapter for RFC Connections to ABAP Systems" to my Web Application Server.  Now I need to develop a JAVA application that would utilize this deployed resource adapter.  The resource adapter specifies the SAPClient, UserName, and password.  I am thinking that the JAVA code to invoke this connection would therefore not need to provide this information as it should be available in the resource adapter.
Do you have sample code that you could send to me showing how to do this?
Thanks,
Kevin

Hi Kevin,
this is actually no good style! You should not open the connection with the adaptor knowing the password. Usually it should work via a connection that uses only basic rights  and the user has already authenticated and is using his security ticket.
For security handling see:
http://help.sap.com/saphelp_nw04/helpdata/en/61/f8bc3d52f39d33e10000000a11405a/frameset.htm
Regards,
Benny

Similar Messages

  • Sample Java code and detail to call RFC from Java clas developed in Eclipse

    Hi All,
    I am new to Java. I have downloaded Eclipse IDE  and planning to use for developing Java application to send data to SAP by calling RFC JCO Interface.
    I need a sample java code/tutorial step by step to create Java class for simple example to call RFC from Java.
    I have downloaded SAPJCO3 from service market place.
    Kindly help me to send steps involved to configure for JCO  with my Eclipse with JCO.
    Thanks in advance.
    Sharma

    Hi Sharma,
    Please have a look at [Example: Using Generated Proxies to Call Function Modules |http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm]
    JCo Exceptions : http://help.sap.com/saphelp_nw70ehp1/helpdata/en/f6/daea401675752ae10000000a155106/content.htm
    Hope it will helps
    Regards
    Arun

  • RFC calls with SAP JCO and IBM resource adapter for SAP - basic tuning

    Hi experts,
    we are working on a java portal connected to a backend system SAP by calling RFCs.
    On our first integration tests, it appears to be quite slow fetching data from SAP by calling the remote functions from the custom portal. We are using SAP JCo 3.0.6 and IBM resource adapter for SAP 7.0.0.3 to integrate SAP with our portal.
    Is there any basic tuning to achieve to improve performances or any hint of where to tune in SAP ?
    Any help would be greatly appreciated.
    Thanks a lot,
    Jamal

    Hi Jamal,
    I understand you have already checked performance issues in the SAP Server. We had some problems with certain RFC calls and it turned out to be a badly developed ABAP sentence.
    I'd recommend you to use httpwatch or another tool to check the response times from the browser, so you can point accurately where the is.
    Regards
    Francisco

  • Sample java code which reads xml attributes using DOM Parser

    Hi Friends,
    I am looking for a sample java code which uses the DOM Parser to read the attributes values.
    My xml looks like below
    <?xml version='1.0' encoding='UTF-8'?>
    <root>
    <header unid="100" status="true">
    <validation stage="1" processed="10"/>
    </header>
    </root>
    Experts please help...
    Thanks in Advance
    JJ

    You have probably found lots of resources on the www for this by now, if not: [http://www.w3schools.com/dom/default.asp|http://www.w3schools.com/dom/default.asp]

  • Anyone tried to deploy IBM's Java resource adapter for IMS on WLS6.1sp2?

              Has anyone had success or attempted to deploy the IMS Connector
              for Java (IBM's resource adapter) on WLS6.1sp2? I would like to
              use this to connect WebLogic to IMS via IMS Connect 1.2?
              Thanks
              Sam
              

              "Sam Naylor" <[email protected]> wrote:
              >
              >Has anyone had success or attempted to deploy the IMS Connector
              >for Java (IBM's resource adapter) on WLS6.1sp2? I would like to
              >use this to connect WebLogic to IMS via IMS Connect 1.2?
              >
              >Thanks
              >Sam
              Sam,
              I was wondering if you were able to use the IMN Connector RAR file. I was able
              to deploy but that was teh extent of my effort.
              Appreciate you insight!
              

  • Inqmy resource adapter for SAP with Bea Weblogic Server

              Hi everybody,
              Anybody have tried to use INQMY resource adapter for SAP with Bea weblogic server
              It works well with INQMY server, but with BEA I'm getting a lot of problems creating
              the connections.
              Thanks in advance.
              Xavi.
              

    All,
              Here are the steps we (used for internal testing) had to perform to get
              IN-Q-MY adapter for SAP to work with WebLogic:
              The wli.adapter.inqmy.sapr3.spi package contains extensions to the
              In-Q-My J2EE Connector Architecture classes to overcome some limitations
              in the base implementation classes. To get around these issues, we had
              to extend their R3ManagedConnectionFactory, R3ConnectionManager, and
              R3ConnectionFactory classes.
              * The javax.resource.spi.ManagedConnectionFactory implementation
              does not over-ride the equals and hashCode methods correctly. This
              causes problems with WLS 6.1.
              * There is a bug in their javax.resource.spi.ConnectionManager
              implementation for non-managed uses of the adapter. Consequently, their
              adapter cannot be used in a non-managed scenario.
              * The javax.resource.cci.ConnectionFactory class does not support
              the getConnection() method that does not take any arguments (it throws a
              null pointer exception).
              I am attaching the classes discussed above.
              Cheers,
              Chris
              Torsten Friebe wrote:
              > Hi,
              >
              > does anybody know where to get a trail version - if one exists - of IN-Q-MY
              > application server or the resource adapter?
              >
              > Thanks, regards
              > Torsten
              >
              > "Xavi" <[email protected]> schrieb im Newsbeitrag
              > news:[email protected]...
              >
              >>Hi everybody,
              >>
              >>Anybody have tried to use INQMY resource adapter for SAP with Bea weblogic
              >>
              > server
              >
              >>?
              >>
              >>It works well with INQMY server, but with BEA I'm getting a lot of
              >>
              > problems creating
              >
              >>the connections.
              >>
              >>Thanks in advance.
              >>Xavi.
              >>
              >>
              >
              >
              package wli.adapter.inqmy.sapr3.spi;
              import java.io.Serializable;
              import javax.resource.ResourceException;
              import javax.resource.cci.Connection;
              import javax.resource.cci.ConnectionSpec;
              import javax.resource.spi.ConnectionManager;
              import javax.resource.spi.ConnectionRequestInfo;
              import javax.resource.spi.ManagedConnection;
              import javax.resource.spi.ManagedConnectionFactory;
              import com.inqmy.r3adapter.R3ConnectionSpec;
              import com.inqmy.r3adapter.R3ManagedConnectionFactory;
              * Extends the In-Q-My implementation to allow for getConnection() with no
              * connection spec, i.e. use the default configured connection parameters.
              public class R3ConnectionFactory
              extends com.inqmy.r3adapter.R3ConnectionFactory
              implements com.bea.connector.IProxyMarker {
              private R3ConnectionSpec m_cspec;
              public R3ConnectionFactory(ConnectionManager cm, R3ManagedConnectionFactory mcf)
              throws ResourceException {
              super(cm, mcf);
              String strClientNumber = mcf.getClientNumber();
              if (strClientNumber == null) {
              throw new javax.resource.spi.IllegalStateException("ClientNumber not set for "+mcf);
              String strLanguage = mcf.getLanguage();
              if (strLanguage == null) {
              throw new javax.resource.spi.IllegalStateException("Language not set for "+mcf);
              String strUserName = mcf.getUserName();
              if (strUserName == null) {
              throw new javax.resource.spi.IllegalStateException("UserName not set for "+mcf);
              String strPassword = mcf.getPassword();
              if (strPassword == null) {
              throw new javax.resource.spi.IllegalStateException("Password not set for "+mcf);
              m_cspec = new R3ConnectionSpec(strClientNumber, strLanguage, strUserName, strPassword);
              public Connection getConnection(ConnectionSpec connectionSpec)
              throws ResourceException {
              if (connectionSpec == null) connectionSpec = m_cspec;
              return super.getConnection(connectionSpec);
              package wli.adapter.inqmy.sapr3.spi;
              import java.io.Serializable;
              import javax.resource.ResourceException;
              import javax.resource.spi.ConnectionManager;
              import javax.resource.spi.ConnectionRequestInfo;
              import javax.resource.spi.ManagedConnection;
              import javax.resource.spi.ManagedConnectionFactory;
              * Extends the In-Q-My implementation to over-ride the
              * allocateConnection method to return a CCI connection vs. a ManagedConnection
              public class R3DefaultConnectionManager
              implements ConnectionManager, Serializable {
              public R3DefaultConnectionManager() {}
              public Object
              allocateConnection(ManagedConnectionFactory mcf, ConnectionRequestInfo cri)
              throws ResourceException {
              ManagedConnection mc = mcf.createManagedConnection(null, cri);
              return mc.getConnection(null, cri);
              package wli.adapter.inqmy.sapr3.spi;
              import javax.resource.spi.ConnectionManager;
              import javax.resource.spi.ConnectionRequestInfo;
              import javax.resource.spi.ManagedConnection;
              import javax.security.auth.Subject;
              * Extends the In-Q-My implementation to get around some problems encountered
              * while running on WebLogic:
              * <ul>
              * <li>Must over-ride default implementation of equals and hashCode method</li>
              * <li>Needed to provide my version of the CCI ConnectionFactory</li>
              * <li>Needed to provide my version of the default ConnectionManager for the
              * non-managed scenario use case</li>
              * </ul>
              public class R3ManagedConnectionFactory
              extends com.inqmy.r3adapter.R3ManagedConnectionFactory {
              private int m_iHashCode;
              transient private com.inqmy.r3adapter.R3ConnectionRequestInfo t_cri = null;
              public R3ManagedConnectionFactory() {
              super();
              java.rmi.server.UID uid = new java.rmi.server.UID();
              m_iHashCode = uid.hashCode();
              public Object createConnectionFactory() {
              // need to install our own default connection manager because In-Q-My
              // version causes a ClassCastException in CCI ConnectionFactory
              // getConnection
              return createConnectionFactory(new R3DefaultConnectionManager());
              public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cri)
              throws javax.resource.ResourceException {
              // need to check for null on the ConnectionRequestInfo object because the
              // In-Q-My R3ManagedConnection ctor does not check for null
              if (cri == null) cri = getDefaultConnectionRequestInfo();
              return new com.inqmy.r3adapter.R3ManagedConnection(this, subject, cri);
              public Object createConnectionFactory(ConnectionManager connectionManager) {
              // need to supply a connection factory that can deal with getConnection
              // that does not take a ConnectionSpec
              try {
              return new R3ConnectionFactory(connectionManager, this);      
              } catch (javax.resource.ResourceException re) {
              re.printStackTrace();
              throw new java.lang.IllegalStateException(re.getMessage());
              com.inqmy.r3adapter.R3ConnectionRequestInfo getDefaultConnectionRequestInfo()
              throws javax.resource.spi.IllegalStateException {
              if (t_cri == null) {
              String strClientNumber = this.getClientNumber();
              if (strClientNumber == null) {
              throw new javax.resource.spi.IllegalStateException("ClientNumber not set for "+this);
              String strLanguage = this.getLanguage();
              if (strLanguage == null) {
              throw new javax.resource.spi.IllegalStateException("Language not set for "+this);
              String strUserName = this.getUserName();
              if (strUserName == null) {
              throw new javax.resource.spi.IllegalStateException("UserName not set for "+this);
              String strPassword = this.getPassword();
              if (strPassword == null) {
              throw new javax.resource.spi.IllegalStateException("Password not set for "+this);
              t_cri = new com.inqmy.r3adapter.R3ConnectionRequestInfo(strClientNumber, strLanguage, strUserName, strPassword);
              return t_cri;
              public boolean equals(Object obj) {
              if (obj == null) return false;
              if (obj == this) return true;
              if (!this.getClass().isInstance(obj)) return false;
              R3ManagedConnectionFactory mcf = (R3ManagedConnectionFactory)obj;
              return compare(getClientNumber(), mcf.getClientNumber()) &&
              compare(getLanguage(), mcf.getLanguage()) &&
              compare(getUserName(), mcf.getUserName()) &&
              compare(getPassword(), mcf.getPassword()) &&
              compare(getServerName(), mcf.getServerName()) &&
              compare(getSystemNumber(), mcf.getSystemNumber());
              protected final boolean compare(final Object obj1, final Object obj2) {
              if (obj1 == obj2) return true;
              if (obj1 != null) {
              return obj1.equals(obj2);
              } else {
              if (obj2 == null) {
              return true;
              } else {
              return false;
              public int hashCode() { return m_iHashCode; }
              

  • Wanted 'Using Sap Adapter for Connector Framework' document

    dear friends
    I want to display ABAP reports in iView without Transaction iView.
    From the below forum link
    /community [original link is broken]
    i came to know i can get the help from 'Using Sap Adapter for Connector Framework' document, but the link is giving
    404
    The requested resource is not available.
    can anybody help me to find out the document
    thanx in advance
    please reply me at the earliest.
    kantha

    have a look here - should help:
    http://help.sap.com/saphelp_nw04s/helpdata/en/f2/db49421c0b3c54e10000000a1550b0/frameset.htm
    <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/f2/db49421c0b3c54e10000000a1550b0/frameset.htm">sap help portal</a>
    you may also download PDK, there are some samples in it.
    Best Oliver

  • Need a java code using swing that can do master configuration

    I need a java code using swing that can do master configuration.For example, in the 1st screen it will show all configuration checke boxes . According to those selected check box, it will show the needed panels sequentially and finnaly it will update many xml files.

    TapasB wrote:
    I need a java code .......and I wish you much luck in creating it. Please come back if you have a specific question on a specific part of your code that is not working quite right.

  • Customizing Resource Adapter for Oracle Internet Directory

    Hi,
    I want to integrate an application which has Oracle Internet Directory as resource. I need to develop a resource adapter for integrating. As Oracle Internet Directory is LDAP v3, can I use LDAP resource Adapter for interaction, if so what customization is required?
    can any one give suggestion reagrding this?

    Hi Bahaugab,<br>
    I am working Oracle OID. I can able to add/modify/delete users from my resource configuration. But I am getting active sync problem with OID. It throws exception like :<br>
    From the admin console please verify that the change log is enabled under Configuration: Replication: Supplier Settings and that the Retro Changelog Plugin is enabled under Configuration: Plug-ins: Retro Changelog Plugin
    <br><br>
    But change log is enabled.
    <br><br>
    I want to know whether your active sync worked?
    <br><br>
    thanks<br>
    Neopal<br><br>

  • Need Sample java code

    Hi,
    iam working in SAP .
    I need sample java code on how to convert Decimal to number
    For Ex: I/p-----123.11
    O/p----------------12311 ( with out decimal) want to remove the dicimal point what ever the input value and deliver it to the output
    Please give me code
    Regards
    Suman

    i don't know what do you want to do really. If you are doing it simply then you can take the input in a String and then remove the decimal.
    String str = "123.11";
    str = str.substring(0, str.indexOf("."));
    System.out.println(str);

  • Sample java code to obtain data from ALUI directory

    Hi
    I need to go to the ALUI LDAP ( directory ) services to get user profile information.
    The documentation did not help me to figure out the way to obtain data from it.
    so , it would be a great help if some one could share the sample java code api to obtain data from ALUI directory.

    i'm guessing you are asking to get the groups for a particular user. someone in the other thread posted the actual SQL, that may be easier. ( you are on 10gR3 right, because ALUI directory didn't exist before 6.5)
    I dont have a sample done yet, but the internet is filled with samples of java and ldap...
    http://www.coderanch.com/t/133108/Security/LDAP-sample-program

  • When & Why to Use WL Adapter for MQSeries as compared to MDB?

              We have a need to both send and receive message via MQSeries in asynch mode.
              Initial assessment was to receive messages via MDB and send messages by use a
              pool of Sessions to the MQ Mgr connection.
              Given this why should one use WL Adapter for MQ?
              Thanks
              Tariq.
              

    I assume you are referring to the "WLI" adapter? Perhaps try posting
              your question to the "weblogic.integration.developer" or
              "weblogic.integration.interest" newsgroup.
              If you are referring to the "Messaging Bridge", which comes with
              WebLogic server, then the advantage is that MQ need not be up for the
              senders to continue sending. Senders can send messages to a WebLogic
              queue, which the bridge can in turn forward to an MQ queue. The
              disadvantage is that the extra bridge hop may slow down your app.
              Tom, BEA
              P.S. You are likely by now aware that WL 8.1 (just released in beta),
              can automatically pool foreign (or WebLogic) sessions for you.
              Additionallly, it provides help in that you can configure wrappers for
              foreign JMS objects. See "Accessing JMS Foreign Providers" and
              "Accessing JMS via Servlets and EJBs" listed under new features:
              http://e-docs.bea.com/wls/docs81/notes/new.html#1125379
              Tariq Bhatti wrote:
              > We have a need to both send and receive message via MQSeries in asynch mode.
              > Initial assessment was to receive messages via MDB and send messages by use a
              > pool of Sessions to the MQ Mgr connection.
              >
              > Given this why should one use WL Adapter for MQ?
              >
              > Thanks
              > Tariq.
              >
              

  • How run reports JDE from BPEL using the Adapter for JD Edwards OneWorld?

    Hi,
    I need to load on line a lot of invoices from Bpel to JD Edwards using the Adapter for JD Edwards OneWorld (iWay).
    Using Business Functions as Web Services it wasn't a not good idea because of this Adapter is poorly constructed and doesn't allow simultaneous loads, a memory leak occurs on JDE server. And to load them invoice by invoice is very slow.
    A choice is to use Z tables and load them through schedules, but Bpel loses total control.
    I heard that I can run processes reports that enable to extract the data from the Z tables and load them into JDE.
    How can I execute reports JD Edwards invoked from BPEL using the Adapter for JD Edwards OneWorld?
    Thanks
    Francisco

    Hi Dario,
    BizTalk 2013 R2 (JDE LOB Adapter) is not tested against latest release of JDE EnterpriseOne 9.1.
    It only supports with 8.12 and 9.0 version of JDE.
    Refer the discussion here:
    Integrating BizTalk with JDE EnterpriseOne
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Resource Adapter for Mainframes!

              Hi,
              Is there any resource adapter available for Mainframes?
              Thanks,
              Thangamani
              

              List of certified resource adapters for MF (VSAM, CICS, ADABAS, Natural, IMS etc)
              can be found in http://www.bea.com/products/servers_integration/adaptermatrix.shtml
              Esti
              "Stefan Krieger" <[email protected]> wrote:
              >You can download a resource adapter for IBM CICS at
              >http://www.comporsys.com.
              >
              >Enjoy,
              >Stefan
              >
              >Thangamani Vaiyapuri <[email protected]> schrieb in im Newsbeitrag:
              >3b52d3f3$[email protected]..
              >>
              >> Hi,
              >>
              >> Is there any resource adapter available for Mainframes?
              >>
              >> Thanks,
              >> Thangamani
              >
              >
              

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

Maybe you are looking for

  • Iweb personal domain

    Has anyone used Iweb to publish a personal website using personal domain? i just installed server osx for maverics. now I want to host a website. help?!

  • How do I get my new username to come up in iTunes

    How do I get my new username to come up in iTunes

  • What´s new in the next release

    Where can I get information about the next release?

  • A1000 F Problem recovery

    Hello, I'm French and i just buy a A1000-F Tablet. I install the 2 updates system to having more space to install application, and after i install "MT6577_Android_scatter_emmc.txt" with Flashtool to having acces to the recovery mode and root the tabl

  • Can't update software on phone

    It says on my provider's website that OS 7.1 is available for my phone (9360). My phone says the current software version is "7.0 Bundle 1555 (v.7.0.0.319, Platform 8.0.0.359". When I got ot the Blackberry update page and try to check for updates, it