Skip to Content
Introduction
I read Renald Wittwer very nice weblog this morning on how to Develop a Web Service that sends an Email. The author gave a very complete walkthrough of how to create this Web Service in the WebAS Java Personality. I thought it might be fun and interesting to take the exact same example in recreate it in ABAP as a WebService. Please note that this example is from a WebAS 640 system and uses new functionality that is only available as of 640.

Updated!The process described in this weblog was done on a Netweaver 04 system. The screens and steps are different for Netweaver 04S. Have a look at Develop a Web Service that sends an Email – in ABAP, Netweaver 04S.

Prerequisites
-WebAS 640 ABAP personality -Configured Email Setup in the WebAS ABAP – See Sending E-Mail from ABAP – Version 610 and Higher – BCS Interface

Create an ABAP Function Module
1. Go to SE80.
2. Create a new RFC enabled Function Module

image

3. Importing Parameters
image

4. Exporting Parameters
image

5. Program Coding

Create a Virtual Interface
1. From SE80 Choose other Object
2. Go to the Enterprise Services Tab
3. Choose Virtual Interface, enter a name, and then hit create

image

4. Fill in the Virtual Interface Parameters, linking it to the function module we just created.

image

5. We now have our generated Virtual Interface

image

Create a WebService Definition
1. From SE80 Choose Other Object
2. Go to the Enterprise Services Tab
3. Choose Web Service Definition, enter a name, and then hit create

image

4. Fill in the Web Services Parameters, linking it to the Virtual Interface we just created.

image

5. We can now set our Features for this WebService. However for this example we will keep everything at the defaults. image

image

image

6. Optionally, we can also publish our WebService into an external UDDI server at this point.

image

Releasing our WebService
1. Now we are ready to go to Transaction WSCONFIG to release our Web Service Definition.

image

Testing our WebService
1. We can now go to transaction WSADMIN to view the WSDL file or test our WebService.

image

2. We can also call our WebService from another programming tool. In the screen shot below we see it in use in Visual Studio .Net.

image

To report this post you need to login first.

19 Comments

You must be Logged on to comment or reply to a post.

  1. Anonymous
    I would definitely like to see what Java can do that ABAP cannot.Though I am aware at a very fuzzy level , would like to see a comprhensive blog on this
    (0) 
  2. Mark Finnern
    Renald writes a great Weblog post and just 5 hours later there is the ABAP version and on the same day another couple pager.

    Tom you never stop to amaze me.

    Thanks Renald and Thomas for some interesting reads, Mark.

    (0) 
  3. Anonymous
    I am using SAP NetWeaver 2004s and I don’t see the same options under SE80 > Other Objects > Enterprise Services. Any ideas?
    (0) 
    1. Thomas Jung Post author
      Yes the screen is different in 04S.  Web Service Definition has been renamed Service Definition and Virtual Interface has been removed.  This is part of the transition to ESA (and improvements in the Web service model).  What was known as the virutal interface and the service definition have been streamlined and combined together. There is the new tab called Variants (and you can have multiple variants per Virutal Interface) in the Virtual Interface that includes the functionality that you could set via the web service definition.  

      In the end the functionality is the same, you just don’t have to jump to as many places to create a web service.

      (0) 
  4. Roberto Calcopietro
    In WSADMIN I try to test the the WebService and the following error occurs:

    503 Service not available
    The service you requested is not available
    Error: -6
    Version: 6040
    Component: J2EE Server
    Date/Time: Fri Dec 1 15:59:52 2006
    Module: http_j2ee_mt.c
    Line: 795
    Server: titania_DER_00
    Detail: Cannot reach external Application Server on localhost:50010

    I don’t know why this is happening, what im trying to do is create web services for varius rfc functions…

    Regards,
    Roberto.-

    (0) 
    1. Thomas Jung Post author
      Well the trest tool from WSADMIN runs out of the J2EE system not the ABAP stack. Therefore based upon this error, I assume that you have WSADMIN configured incorrect (wrong URL to the J2EE) or there is something wrong with J2EE system – that being the application server that you can not reach. 
      (0) 
    1. Thomas Jung Post author
      Is it actually listing XXX.com:8012 or did you change that.  I suspect either way there is incorrect configuration in your system around the hostnamefull parameter that is causing the WSDL to generate an incorrect URL.
      (0) 
  5. Bertrand DESSERTENNE
    Hi ,

    First, thanks for this blog it’s very helpfull.

    I try to generate a web service from a RFC Function module .

    For this i use the wizard available in SE80 . I made each step but at the end the web service is not generated . Any idea of what’s wrong ?

    Best regards.

    (0) 
    1. Thomas Jung Post author
      Well a few more details on exactly what is happening (or not happening) will probably be necessarly before anyone can help you with your problem.  However the service wizard is rather straight forward and if you receive no results at the end (or an error message), then you might be best simply opening a support ticket on the problem.
      (0) 
  6. Juan Carlos Velarde Saravia
    Hi Thomas, i am development a webservice under WAS Abap Stack. I haven`t a J2EE Server, i test my web service with the next url: http://maqui09.maquinarias:8001/sap/bc/srt/rfc/sap/zprueba_ws?wsdl, the result is good, show me the wsdl, but when i test the service with this url: http://maqui09.maquinarias:8001/sap/bc/srt/rfc/sap/ZPRUEBA_WS?sap-client=100, i can’t :(, show this error:  HTTP 500 Server Intern Error. I suposse that my WAS Abap have a wrong configuration? or i need config a some port?. Please help me Thomas.
    (0) 
    1. Udo Eirich
      Hi Juan,
      I have the same problem. The request for the wsdl (your first url) works for my wsdl. But the request for the actual web service (your second url, which is located in the wsdl) does’t work neither.
      Have you solved the problem yet?? Do you know the reason by now?? Thanks,
      Udo
      (0) 
      1. Juan Carlos Velarde Saravia
        Hello Udo, yes i solved this. Well, this error occurs because I don’t have Sap WAS with Stack Java, only Abap. But This wasn’t necesary for the functionality of my web service. Java Developers used the URL of the WSDL of my Webservice and they could execute this. That was great. Onle Java Stack is necesary to test my Webservice within Sap directly.
        (0) 
  7. Juan Carlos Velarde Saravia
    Hi Thomas, i am development a webservice under WAS Abap Stack. I haven`t a J2EE Server, i test my web service with the next url: http://maqui09.maquinarias:8001/sap/bc/srt/rfc/sap/zprueba_ws?wsdl, the result is good, show me the wsdl, but when i test the service with this url: http://maqui09.maquinarias:8001/sap/bc/srt/rfc/sap/ZPRUEBA_WS?sap-client=100, i can’t :(, show this error: HTTP 500 Server Intern Error. I suposse that my WAS Abap have a wrong configuration? or i need config a some port?. Please help me Thomas.
    (0) 
    1. Thomas Jung Post author
      The main difference I see in your second URL is that it is specifying the client.  Are you sure that this is the correct client you want to log into?  Otherwise it is hard to tell from just the URL if you have missing configuration.  I would suggest that you check the SMICM logs for more details.
      (0) 
  8. manik wadhawan
    Hi Thomas,

    Is it possible to Trigger a outbound Web Service from withing SAP to different system, like outbound IDOC ??

    Example: trigger a web Service containing Sales Order data, based on the (SAVE) event generated in SAP system and send the XML to 3rd party system along with the data

    /Mike

    (0) 
    1. Thomas Jung Post author
      Yes.  That is completely different that this blog where we are just exposing a web service. In what you describe you would be calling a web serice exposed on a 3rd party system.
      (0) 

Leave a Reply