craig.gutjahr

7 Posts

*Consume
a Web Service in ABAP*



* *It is impossible to implement all of the necessary
functions associated with a complex business problem in the same component or
even technology. A modern enterprise infrastructure system must be in the
position  to integrate functions in one
effective process. Until now, the combination of different applications have
been developed using point-to-point solutions which grow complex and impossible
to maintain over time.





 Web Services simplify the heterogeneous nature of
most mature enterprise system landscapes. They enable you to combine functions
in a single process, even if they are implemented in widely differing software
components. Web services are standalone, executable entities that can be
published, searched for, and called, across a network.





 To consume a web service via the ABAP engine,  you  need to do the following:



 



    • Create
      a Logical Port




 The creation of a proxy for the Web service in the
ABAP Workbench using a WSDL document can be done in a few clicks. Once the
proxy has been created a logical portal will be needed. Once those two tasks
are completed, the Web Service can be called via a standard API.



This demonstration was built for some much needed ABAP practice and because I never really found a WORKING example. Enjoy..



 

Setup Information



 



 

URL:  http://www.deeptraining.com/webservices/wsStrings.asmx?WSDL



+Note
that SAP only supports WSDL 1.1 ( at least from what I can tell )+



+ +



 



*1.     
*Create Client Proxy



 



You can generate client or server proxies in ABAP
to send or receive messages. You generate client proxies in this example. The
client proxy will provide an abstraction to the complexities of the web
service.



 



TCODE: SE80

 





Click on *EDIT
OBJECT*



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-2.jpg|height=225|alt=|width=336|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-2.jpg!



 

Select EnterpriseServices



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-3.jpg|height=247|alt=|width=274|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-3.jpg!



 

Enter the name of the Client Proxy (ZCG_CO_WEATHER_WS) and click the CREATE button.



 



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-4.jpg|height=244|alt=|width=325|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-4.jpg!



 

Select +URL/HTTP Destination+ and press the Continue  button.



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-5.jpg|height=251|alt=|width=337|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-5.jpg!



 

Enter the +WSDL +in the URL field and press the *Continue *button



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-6.jpg|height=236|alt=|width=313|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-6.jpg!

 



 

For simplicity select Local Object and enter a value in the Prefix field. Press the *Continue *button.



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-7.jpg|height=218|alt=|width=289|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-7.jpg!



 

Press the Complete button.



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-8.jpg|height=200|alt=|width=385|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-8.jpg!



Remember to *SAVE
*and then *ACTIVATE *you code.



 



*2.    
*Create Logical Port



* *



You configure runtime features for Web services
client proxies using logical ports.



 



These runtime features can be configured when the
Web-service client is activated. An example of such a feature is the URL-call
of the Web service, which, if applicable, must be modified by users.



* *



TCODE: LPCONFIG



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-9.jpg|height=158|alt=|width=505|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-9.jpg!



 

Enter the Proxy class and Logical Port name. Make sure that DefaultPort is selected. Click the Create button



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-10.jpg|height=280|alt=|width=349|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-10.jpg!



Enter a description for the logical port.



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-11.jpg|height=137|alt=|width=420|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-11.jpg!



 

Enter the WSDL URL into the URL fieldCopy the URL defined in that line into the SOAP Action line.



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-13.jpg|height=172|alt=|width=529|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-13.jpg!



 



Save and then Activate the Logical Port



 



*3.    
*Test the Web Service
Call



* *



TCODE: se80



 



To test the web service call load the client  proxy in SE80



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-14.jpg|height=176|alt=|width=368|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-14.jpg!



 

Click on the TEST icon



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-15.jpg|height=205|alt=|width=421|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-15.jpg!



Click on the *Execute
*button



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-16.jpg|height=238|alt=|width=432|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-16.jpg!



Since the web service simply converts a string to
all upper case, you can now click on the *EXECUTE
*button.



 



+Note: +You can
also now change the default value being sent to the web service



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-17.jpg|height=188|alt=|width=267|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-17.jpg!



As you can see you can even upload an entire file



 



 



!https://weblogs.sdn.sap.com/weblogs/images/14515/12510-18.jpg|height=167|alt=|width=323|src=https://weblogs.sdn.sap.com/weblogs/images/14515/12510-18.jpg!



If the test is successful you will see your
returned string in all Upper Case



 



 



*Call the Web Service
within an ABAP Function*



* *



FUNCTION Z_CG_TOUPPER_TEST.

*"----

""Local Interface:

*"  IMPORTING

*"     VALUE(INPUT_PARAMETER) TYPE  STRING

*"  EXPORTING

*"     VALUE(OUTPUT_PARAMETER) TYPE  STRING
*"----




DATA: WSProxy TYPE REF TO ZCG_CO_WS_STRINGS_SOAP .

TRY.

    CREATE OBJECT WSProxy .

    CATCH CX_AI_SYSTEM_FAULT .



ENDTRY.



   data: ls_response type ZCG_MAKE_UPPER_SOAP_OUT .

   data: ls_request type ZCG_MAKE_UPPER_SOAP_IN .



   ls_request-DATA = INPUT_Parameter .



TRY.

CALL METHOD WSProxy->MAKE_UPPER

  EXPORTING

    INPUT  = ls_request

 IMPORTING

    OUTPUT = ls_response .



 CATCH CX_AI_SYSTEM_FAULT .

 CATCH CX_AI_APPLICATION_FAULT .



ENDTRY.



COMMIT WORK.



OUTPUT_Parameter = ls_response-MAKE_UPPER_RESULT .





ENDFUNCTION.



 



 

For more information, please visit NetweaverCentral  </p>
I know this isn’t one of my ‘normal’ blogs, but I have a question for the SAP developer community. When developing new and custom web applications, which development strategy do you take?

I believe there are about three different options:

-    WebDynPro – Java Flavored

-    WebDynPto – ABAP Flavored

-    A ‘non-SAP’ architecture – For simplicitiy lets say its PHP using the PHP-to-SAP connector


What experiences have people had with these and what are your feelings toward how YOU would start a new custom project..
One of the benefits of being a consultant is the opportunity to utilize new technologies. At the start of new installations clients opt to use the newest technologies ( you always want to guide them away from ‘bleeding edge' technologies.. but that's a different story ). But there are also some projects which require a consultant to ‘turn back the clock' and get re-familiar with older projects.

On one of my recent projects, I was luck enough to use a recent release of the SAP Netweaver Portal which has the new AJAX Framework pages and Themes available. I decided to take this opportunity to take some screenshots and share them.

 

Logon Page

 

Whole Portal

 

Detail - Tool Area

 

Detail - Page Header Area

 

Detail - Top Level Navigation (System Administration selected )

 

Detail - Second Level Navigation

 

Detailed - Detailed Navigation

 

One of the big questions that I have taken away from seeing the new look and feel is how easy is it to configure? There are options in the Theme Editor, but most of the selections are to change the graphical components.  

Unfortunately, not everyone adheres to the SAP blue palette. Isn't it the point of the portal to allow companies to PERSONALIZE it to their own branding?

 For more information check out NetweaverCentral

  With the release of BI7.0 SAP introduced a requirement to force the use of a combination of a Java stack along with an ABAP stack.

 

A majority of the BI ‘engine' is still running on the legacy ABAP engine. The newer web template functionality is now hosted on a Java stack. In order for the application to work correctly the communication between the two stacks has to be functioning correctly.

 

In a ‘legacy' portal to BI3.5 integration the integration between the portal and BI system is configured in a single location: a portal system. However, there are many more integration points required between the portal and a BI7 instance.

 

 

To help in debugging issues that arise when configuring the connection between the two systems, SAP has developed a tool which can be run to help identify issues and provide clues as to how to fix them; the SAP NetWeaver BI Diagnostics & Support Desk Tool.

 

 

 

Solution:

 

 

 

0.1.

2. Once the tool has been deployed to the Java stack, it can be access via <http|https>://<j2ee_server>:<j2ee_port>/irj/servlet/prt/portal/prtroot/com.sap.ip.bi.supportdesk.default 

0.1. 3. After logging in ( see Note 937697 for security requirements ), you will be prompted with an overview screen. This screen will tell you if your configuration is working properly or not

 

!https://weblogs.sdn.sap.com/weblogs/images/14515/82009-1.jpg|height=1|alt=|width=1|src=https://weblogs.sdn.sap.com/weblogs/images/14515/82009-1.jpg|border=0!

 

0.1. 4. The +stoplight +at the top of the screen will tell you immediately if you have a properly configured system

 

 

0.1. 5. The RED light lets you know that there are issues with your system configuration. Scroll down to the bottom of the screen for more specific information.

 

 

 

 

0.1. 6. As you go through each item with a RED light, you will see suggestions from SAP on how to solve them.

 

 

!https://weblogs.sdn.sap.com/weblogs/images/14515/82009-4.jpg|height=74|alt=|width=644|src=https://weblogs.sdn.sap.com/weblogs/images/14515/82009-4.jpg|border=0!

 

0.1.

7. Once you have solved each of the problem items, click on the Reload Configuration button at the top of the screen to re-run the tests 

 

!https://weblogs.sdn.sap.com/weblogs/images/14515/82009-5.jpg|height=114|alt=|width=468|src=https://weblogs.sdn.sap.com/weblogs/images/14515/82009-5.jpg|border=0!</body>

When talking with customers, one of the primary annoyances they have with the SAP Netweaver suite is the lack of adherence to some basic web standards. These standards have been around since the early days of the web and users are truly accustomed to them.

 

Whenever I am involved with a Netweaver rollout, I make an effort to customize the environment to meet the expectations of the general users. These users are not truly power users but the use SAP enough to understand its ... quirks?

 

One of the big annoyances that users have is the unique default web address that the portal utilizes. Typically that URL is something like this:

 

            http://tds-prd.company.internal.adr:50000/irj/portal

 

For the Netweaver team this makes perfect sense.

  • The tsd-prd is the machine name
  • The company.internal.adr is the domain name
  • The 51000 port represents that it has a system number of 01
  • The irj/portal is just something that you have to deal with

 

Fortunately, there are ways around most of these issues. Today I would like to describe to you how to fix the last issue ( irj/portal ).

 

Solution:

 

  • Log into the Visual Admin

 

 

  • Enter an administrator user and password

 

  • After logging on, select the Services branch under the Server node

 

  • Select the HTTP Provider Service

 

 

  • The pane on the right-side of the Visual Admin will update. In the Properties box and under Location enter /irj in the Start Page field

 

 

  • Press the Save Properties button and restart the J2EE server

 

 

 

After you make these changes, users will only need to enter http://tds-prd.company.internal.adr:50000/ to reach the portal.

 For more information vist http://www.netweavercentral.com or email me directly (cgutjahr@spyvee.com)

I 'just' saw the article on the front door of SDN.  'Why ABAP Performs Better in Portal Development than JAVA'  Suffice to say.. I am speechless.. I am opening this weblog so we can have a discussion of the merits of the article, and we will have a record of our discussion.
I noticed a recent posting concerning a new feature in SP3 (or is it SP4?) which would allow portal administrators to quickly link RSS feeds into the portal by utilizing an out of the box RSS to XHTMLB translation server.

Thinking that this was pretty interesting, I went through my portal and looked for this XML iView component but couldn&#146;t find it. I won&#146;t lie to you and say that I was devastated, but I thought that I got my hopes up for nothing..

After a while, I said to myself &#147;self.. why not use another open-source solution to allow for quick and easy parsing for XML via XSL.&#148; Now, I wouldn&#146;t consider myself the greatest JAVA developer in the world, but I could hold my own.

I spend a few minutes and whipped up a small iView which will allow portal administrators to integrate remote information sources into their portal. The iView has two custom parameters (XSLSource and XMLSource). Pretty straight forward. XSLSource is the URL to the XSL file used in parsing. XMLSource is.. you guessed it.. the URL to the XMLSource.

The iView that I wrote is VERY simple. In fact it consists of a single class and about 40-50 lines of code (including import statements!). I decided to use the XALAN (http://xml.apache.org/xalan-j), to provide a simple and quick XSL parsing mechanism.

Here is an example XSL File and RSS Feed
XML Source : http://p.moreover.com/cgi-local/page?c=Developer%20news&o=rss
XSL Template : http://www.fullxml.com/engine/rss/rss.xsl

Again, I cannot stress how SIMPLE this example is. If people are interested I could modify the code to show how instead of requiring a URL for the XML/XSL sources, you could place the content in other locations ( Knowledge Management.. for example).

Download it now.. Download
PAR file is located within the ZIP

Filter Blog

By date: