cancel
Showing results for 
Search instead for 
Did you mean: 

Java WD and Socket Communication

Former Member
0 Kudos

Hi,

Is it possible to use Java Socket Communication with Java Web Dynpro. Or if not what is the best approach to have a Java Socket program integrated with a Web Dynpro Communication.

Basically, I have an application which provides API for communication via Java Sockets.And this needs to be integrated in our SAP application.

Thanks,

CD

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

you can build a plain Java Class that contains your socket coding. Use this Java - Class as a JavaBean Model. Make sure to implement Exception Handling and to close the Sockets you open once you finished the communication.

By the way: Opening of a Socket in a EJB is forbidden by EJB specification.

Regards

Johannes

Former Member
0 Kudos

Thanks guys for replying,

I"ll give it a try..

One more question, in the exisitng application we do this by a JCo program running behind custom screens.

I was wondering if a JCo program can be integrated with a Java WD? Sorry this may be a silly question, but I am very new when it comes to Java WD.

Thanks,

CD

Former Member
0 Kudos

Hi,

with webDynpro/Java you wont need to handwrite Jco-code anymore, just use the RFC Model import and use the generated Model classes directly in your controller context.

This will help you with your first steps: http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-Adaptive+RFC

Give it a try, once you got used to the underlying concept you won't want to switch back to the old (deprecated) coding.

Jan

Former Member
0 Kudos

Jan thanks once again for the prompt reply.

Just to clear, isnt the RFC you are referring for Java WD to communicate with ABAP systems or it implies to all.

Former Member
0 Kudos

Hi,

If your Java API uses JCO to connect to SAP, you don't need to use it while working with WDP.

I think you should gather your requirements first. What you need to do? - After that, you will leverage that with your Java API - What's the API doing? - What are the back-end calls being executed?

With that, you can have two approaches:

1. You can either "Code" your calls, (Import RFC Models into WDP) in you application, in order to achieve your requirements;

2. You can 'Code" your own "API" which simulates this one in JCO, using WDP. This would be a DC, and you could use all around your SC track.

I don't see any good reason to have an "API" working with JCO. I assume there are some helpers around, maybe some wrappers in this API which "helps" you use JCO. If this is the case, you should consider "where" to use POJO x Structures while under WDP.

Hope it helps,

Daniel

Former Member
0 Kudos

Daniel, thanks for reply,

Let me be more clearer. I am trying to figure out the best approach with minimum layers for the task below:

Task: Connect to a remote system which provide a Java API to query it via Java socket communication.

In the exsiting system UI is in SAP screen dynpro and JCo program acts a middleware between ABAP stack and the remote system. Using PI is not an option.

Now we are planning to convert it to a web application. Plan is to use WD, but I am not very sure about the very best approach to replace the existing JCo middleware.

One of the simplest solution would be to use ABAP WD with existing JCo program but I personally feel that this is not a very clean approach.

So I am exploring Java WD to see if I can bundle the complete application using Java WD framework.

Former Member
0 Kudos

Hi,

You are currently using JCO to "Connect to a Remote System" - JCO will connect to a back-end with the main purpose of "executing BAPI's" in it.

When you move to WebDynpro, you have what SAP calls Adaptive RFC Model - this will create a "Model Entity" in you WD Project that will do the same thing your JCO does.

Assume your JCO now calls "BAPI_GET_FLIGHTS", to return the Flights that are currently available - In your newly create WDP Project, you will manually specify what back-end you wanna use when "Importing" and you will tell also the BAPI name. WDP will generate the class structure that you need in order to execute that function.

JCO is what SAP created to execute BAPI's. JCO can be used by any "Java" like application that needs to connect to the back-end. But when you move to WDP, you don't need to use this anymore - You will use WDP Models.

Youi will still need your JCO Destinations created in the Application Server, so behind the scenes WDP creates a "layer" so you don't need to code the JCO calls manually.

Regards,

Daniel

Former Member
0 Kudos

first idea: import your java api as a model and bind it to the context. If not applicable: wrap your java api with EJB and use EJB model import, that way, all Backend calls can be done via a fixed api (execute, request, response)

Jan