cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a web service from Java

david_fryda2
Participant
0 Kudos

Hi everyone,

What are the steps for calling a web service from a Java class (not servlet, not JSP) ?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi David,

I don't exactly understand your problem. Looks like you're doing all things right.

Do you want to know the difference between deployable and standalone proxy? The SAP Library defines proxies in the following way:

· deployable proxy – a Web service client that must be deployed on the J2EE Engine as an application.

· standalone proxy – a Web service client that generates stubs and runs without the J2EE Engine. This proxy can be used only with the release for which it has been generated.

So, if your client resides on the J2EE-Engine, you can use a deployable proxy.

With a standalone proxy you're acting more idependtly from the engine.

tom

david_fryda2
Participant
0 Kudos

Hi Thomas,

I explain my problem :

I do not success calling the proxy of the web service from a Java standalone class.

But, I do success calling a web service from a servlet and a webdynpro.

My Java client program is not located on the server which means that I must use Standalone Proxy for the web service.

Is it correct ?

If yes, how can I use the standalone proxy ?

Do I have to check the JAX-RPC option ?

What are the jars I need.

Thnaks a lot.

Message was edited by: David Fryda

Answers (4)

Answers (4)

Former Member
0 Kudos

David,

Have you found the solution to this problem? Please do share.

This link http://java.sun.com/developer/technicalArticles/J2EE/j2ee_ws/ from Santhosh Chandran provides useful info.

Thanks,

Julie

Former Member
0 Kudos

Hi David,

take a look at the following link:

http://help.sap.com/saphelp_nw04/helpdata/en/24/d0ff2f5d872a468b4643e1fa740569/frameset.htm

It desrcibes in depth the creation of a client.

tom

david_fryda2
Participant
0 Kudos

Hi Thomas,

I am having problems to execute a web service from Java.

Can you please tell me if I am right about how running a web service.

Steps are :

1) create a web service.

2) create a deplyable or standalone proxy.

3) deploy proxy to J2EE engine server.

4) create a Java project and the client class.

5) create a context.

6) lookup the proxy.

Is it OK ? Am I missing something ?

Thanks.

NB : what are the jars that you use ? (p4.jar, ejb20.jar, etc).

guru_subramanianb
Active Contributor
0 Kudos

Hi David,

Refer this following link.It contains detailed description of Webservices,how to call them.

http://help.sap.com/saphelp_nw04/helpdata/en/9b/dad1ae3908ee44a5caf57e10918be9/frameset.htm

Hope this helps your requirement.

Regards,

Guru Subramanian B

Former Member
0 Kudos

Hi David,

Refer to the following link

http://java.sun.com/developer/technicalArticles/J2EE/j2ee_ws/

This will be useful for you. The link has a sample code for calling a web service.

Regards,

Santhosh.C

david_fryda2
Participant
0 Kudos

Hi,

Thanks for the links.

The question is how do I call a web service like the one that points on the BAPI_USER_GETLIST from a java standalone class and not from a servlet ?

Do I have to create a Proxy with Netweaver ?

What are the steps.

Thanks for your help.

Former Member
0 Kudos

> Hi,

>

> Thanks for the links.

>

> The question is how do I call a web service like the

> one that points on the BAPI_USER_GETLIST from a java

> standalone class and not from a servlet ?

>

> Do I have to create a Proxy with Netweaver ?

> What are the steps.

>

> Thanks for your help.

Well I don't know what your total config is.

If you have a java WS that points to the BAPI and try to call it outside the java WS provider you will be out of luck.

Assuming that your WS is defined on the ABAP stack and points to the BAPI, you will need to follow the WS standards (see the exemples at java.sun.com).

If you have the WS running on your java stack and are talking about a stand alone without running the java stack it just won't happen. You need to have the java stack running and call the WS on that java stack.

Enjoy