Skip to Content

Introduction

You might be thinking: how is consuming WebServices in ABAP really related to BSP.  Is it because the WebAS and the ICM (Internet Communication Manager) are at the core of both technologies?  Or perhaps it is because you might describe Consuming WebServices in ABAP as BSP turned inside out?  When it comes right down to it, I included this in BSP Weblog because for me using WebServices just goes hand-in-hand with the applications that I happen to be developing in BSP.  But don’t feel that this technology is limited to BSP.  In fact all the samples I am going to share today run within good old traditional ABAP.  There is even one with – gasp – just plain List Output (talk about combining old technology with new!).

Release 620

First off there is no easy, good way of consuming SOAP WebServices in 620.  There is a client API realized as an ABAP Class Library.  But if you read the SOAP Processor section on the service marketplace , you see that this method in 620 is basically incompatible with release 640. You have to work directly with the SOAP request at a fairly low level in the 620 API because proxy generation is not supported.  All this and then you read the statement: 

applications based on this interface therefore will face a considerable migration workload. Automatic conversion will not be possible.

Well that was enough to convince me to wait until 640 for full SOAP WebServices.

I was faced with a problem. I have a requirement to build an application that sends SMS messages to cell phones in Poland. Our SMS provider was only giving me the option of interfacing via a SOAP WebService. I needed the working interface up in running by September 2004. But at this time, our 640 upgrade was more than 6 months away. I didn’t even have a copy of the install media yet! But as people in the area I live in are prone to say, there is more than one way to skin a cat (makes you wonder what we do for fun around here). In 620 I may not have a good SOAP WebService client, but I do have a HTTP Client. Meaning I can make HTTP requests and process the response from ABAP. So why not simplify the interface by removing the SOAP. We make a request and on the URL we specify certain parameters (SMS Number, Priority, Message, etc). The service provider processes the request and sends us back a confirmation number and status in the response object. Little did we know at the time that we were flirting in the SOAP vs. REST area of WebServices. Now I have never been the type of person to get involved in theoretical debates about the potential uses of technology. I’m more of Git-‘R-Done kind of guy. Does the solution meet the requirements, budget, and timeline? Can I support it after we go live. If yes – then I say go for it. If you are interested in the SOAP vs. REST debate you can find plenty of articles on the web (and a few right here in SDN).

Configuration

Before we could really get started with this solution, we needed to configure a few things in the WebAS of course. First we will be passing HTTP(s) out of our Corporate Network, across the public Internet, and finally reaching our Service Provider (hopefully!). That means that like most corporations, we needed to configure our proxy settings for passing through the firewall. You can find these settings in Transaction SICF under GOTO->HTTP Client Proxy. You can probably just copy the same settings that you find in your web browser to complete these settings. If not have a chat with your network administrator.

We are going to be using HTTPS for our communication. Therefore we need to add our provider’s certificate to our Trust Manager. We can do this from transaction STRUST. Choose Environment->SSL Client Identities from the menu. This screen allows us to create a short SSL ID that we will attach our certificate to. We will also use this same ID later in our ABAP code to include this certificate in our HTTP Processing. We can return to the main screen in STRUST and upload their certificate. I had already navigated to the HTTPS URL that we would be using with my Internet Explorer browser. Therefore all I had to do was go into Certificates Listing in IE and Export the certificate. If you export as DER encoded binary X.509 (.CER) this matches up to the import option in SAP of File Format Binary.

!https://weblogs.sdn.sap.com/weblogs/images/1918/Export_Cert1.jpg|height=272|alt=image|width=486|src=https://weblogs.sdn.sap.com/weblogs/images/1918/Export_Cert1.jpg|border=0!

!https://weblogs.sdn.sap.com/weblogs/images/1918/Export_Cert2.jpg|height=166|alt=image|width=435|src=https://weblogs.sdn.sap.com/weblogs/images/1918/Export_Cert2.jpg|border=0!

!https://weblogs.sdn.sap.com/weblogs/images/1918/Export_Cert3.jpg|height=210|alt=image|width=470|src=https://weblogs.sdn.sap.com/weblogs/images/1918/Export_Cert3.jpg|border=0!

You then should see your certificate under your SSL ID with a green light.

!https://weblogs.sdn.sap.com/weblogs/images/1918/STRUST1.jpg|height=395|alt=image|width=559|src=https://weblogs.sdn.sap.com/weblogs/images/1918/STRUST1.jpg|border=0!

Coding

We are ready to look at the coding now. We will break it down into little parts so that is can be easily digested. First I implemented this functionality as a function module so that it can be called via RFC from our 46C R/3 system. I take in the SMS number, the Message Class, the Message, and the Priority as importing parameters. I then pass back the unique SMS confirmation number, the status and the entire HTTP response as a string.

*”—-


“Local interface:

*”  IMPORTING

*”     VALUE(SMS_NUMBER) TYPE  AD_PAGNMBR

*”     VALUE(CLASS) TYPE  CHAR1 DEFAULT 1

*”     VALUE(MESSAGE) TYPE  STRING

*”     VALUE(PRIORITY) TYPE  CHAR1 DEFAULT 3

*”  EXPORTING

*”     VALUE(SMS_ID) TYPE  ZZES_SMS_ID

*”     VALUE(STATUS) TYPE  ZZES_SMS_RESULT_STATUS

*”     VALUE(P_CONTENT) TYPE  STRING

*”  EXCEPTIONS

*”      MESSAGE_TOO_LONG

*”      UNKNOWN_ERROR

*”—-


I wanted to make it easy to support different SMS providers or to make changes to the URL and SSL_ID; so ended up setting up everything in a configuration table.

!https://weblogs.sdn.sap.com/weblogs/images/1918/SMS_Config.jpg|height=122|alt=image|width=595|src=https://weblogs.sdn.sap.com/weblogs/images/1918/SMS_Config.jpg|border=0!

So we can then start of function module with a little bit of code to read the configuration settings from the config table.

Next up I want to perform some checks on the input data. First I will check to make sure the message isn’t too long. Next up I want to check for Polish Characters. Even though we are going through a Polish SMS provider, they asked us not to send any Polish National Characters. So we will use some SAP function modules to check the codepage of the string and then transliterate any national characters back to ASCII7. Finally we will replace any + in the SMS number and remove any spaces.

Next up is where things get really interesting. We will build our full Request URL by adding on all of the outbound parameters. We create the client object for this URL.

Next up we set our request type to ‘GET’ and start the HTTP communications.

Now we are ready to receive the response back. We read it in character format. We then pull out the return parameters from this response block.

In the end we have fairly simple approach to what could have been a complex problem. We leverage the ability of the WebAS to act as an HTTP client and create an end result that functions very much like a WebService.

Release 640

If you really had your heart set on consuming SOAP WebServices from ABAP, you aren’t out of luck.  WebAS 640 comes along and makes the process relatively painless by offering the ability to generate proxy classes.  Since this technology is so new, I thought I might just build and walkthough a complete example here.  I wanted to use a public webservice that was available for free for several reasons.  First I wanted to demonstrate how flexible the technology was.  Second I wanted anyone with a 640 system to be able to recreate the steps in this weblog on their own with the same webservice.  I found a nice collection of webservices at the following web address: www.xmethods.com . I finally decided upon a simple service that returns book information when given an ISBN.  It even gives us the current price of the book at several on-line retailers.  The Service Description can be found here: http://www.winisp.net/cheeso/books/books.asmx .

Now that we have our webservice picked out, we are ready to generate our ABAP Proxy. To get the process started, we turn to our old friend SE80. From the Enterprise Services Tab, we are going to select Client Proxy and then hit create.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC1.jpg|height=257|alt=image|width=421|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC1.jpg|border=0!

Next up we have to choose where our WSDL file is going to come from. We could connect directly to a UDDI server or XI repository and query for our object. Or we might have saved the WSDL definition to a file on our local machine. But in this case we are going to connect directly to the WSDL definition using the URL that we got from our on-line search.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC2.jpg|height=149|alt=image|width=197|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC2.jpg|border=0!

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC3.jpg|height=131|alt=image|width=440|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC3.jpg|border=0!

Now we are asked what Package (Development Class for those you upgrading from 46C or lower) we want to place the generated object in as well as what prefix we want to use. I’m just playing around so I am going to make the object Local Private by putting in my $TMP package. To follow SAP naming standards, as well as my company’s standards, I will get the object a prefix of ZES_ (In case you are wondering – the object starts with Z to follow SAP’s naming standard for customer development. The next letter E standard for Electronics – the division I work for. Finally the S stands for Basis – the application area that this development belongs to.)

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC4.jpg|height=109|alt=image|width=393|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC4.jpg|border=0!

We have our generated Client Proxy. The following are some screen shots of what this should look like in SE80. You can see that not only do we have an ABAP class, but the process also generated structures and table types to represent all the importing and exporting data.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC5.jpg|height=399|alt=image|width=573|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC5.jpg|border=0!

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC7.jpg|height=398|alt=image|width=598|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC7.jpg|border=0!

There is only one last thing we need to do to our Client Proxy before we are ready to use it: we need to configure a Logical Port for it. We can do this in transaction LPCONFIG. We can configure more than one Logical Port and specify the one we want at runtime. However for this solution we will just configure one port and make it the default.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC8.jpg|height=190|alt=image|width=426|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC8.jpg|border=0!

Inside the definition of the Logical Port we can adjust settings for the Client Proxy such as the URL we going to call, the logging, State Management, etc. Since this is the default Logical Port, we will just save it with all the settings that were imported from the WSDL definition.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC9.jpg|height=355|alt=image|width=473|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC9.jpg|border=0!

We can then return to SE80 and perform a test on the WebService by hitting F8. We then get a dialog that allows us to set parameters for our test.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC10.jpg|height=397|alt=image|width=486|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC10.jpg|border=0!

We then choose which method we want to invoke. We are going to be using the GET_INFO method later in our example, so let’s test that.

!https://weblogs.sdn.sap.com/weblogs/images/1918/WSC11.jpg|height=232|alt=image|width=462|src=https://weblogs.sdn.sap.com/weblogs/images/1918/WSC11.jpg|border=0!

Hopefully you get a success message like the following:

image

Once everything checks out OK in the test tool, we are ready to start programming against our Client Proxy. The following program example has one parameter for supplying the ISBN. We then take this parameter and use it to fill out the request object for our Client Proxy. After the call to the Client Proxy, all the returned data is contained in our response object. The response object has the format of the generated table types and structures as defined in the WSDL file. We can loop through this data and process as we see fit. For this case we are just going to output a simple ABAP list.

PARAMETER: p_isbn(100) TYPE c OBLIGATORY.

DATA:

  • Reference variables for proxy and exception class

  lo_clientproxy     TYPE REF TO zes_co_looky_book_service_soap,

  lo_sys_exception   TYPE REF TO cx_ai_system_fault,

  • Structures to set and get message content

   ls_request         TYPE zes_get_info_soap_in,

   ls_response        TYPE zes_get_info_soap_out.

****Set the input parameter ISBN into the Request of the SOAP Object

ls_request-isbn = p_isbn.

****Create the Proxy and Clall it.

CREATE OBJECT lo_clientproxy.

TRY.

    CALL METHOD lo_clientproxy->get_info

      EXPORTING

        input  = ls_request

      IMPORTING

        output = ls_response.

  CATCH cx_ai_system_fault INTO lo_sys_exception.

  •   Error handling

ENDTRY.

COMMIT WORK.

****Write Out the Basic Information

WRITE: / ‘ISBN:’, ls_response-get_info_result-isbn.

WRITE: / ‘Title: ‘, ls_response-get_info_result-title.

WRITE: / ‘Author: ‘, ls_response-get_info_result-author.

WRITE: / ‘Publish Date: ‘, ls_response-get_info_result-pubdate.

WRITE: / ‘Publisher: ‘, ls_response-get_info_result-publisher.

WRITE: / ‘Format: ‘, ls_response-get_info_result-format.

****Loop through the listing of Vendor Prices and output each one

FIELD-SYMBOLS

What I showed you here today is the tip of the iceberg for this technology.  The possibilities for connecting applications through WebServices (even with different implementing technologies) are quite exciting.  This is just one of the many new areas of NetWeaver that we all have to look forward to.

To report this post you need to login first.

123 Comments

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

  1. MARCUS RAATH
    Thanks for your informative articles.

    My objective is to get an SAP system integrated via the ABAP stack and not the java stack.
    The application being connected to is generating complex WSDL files.

    Has anyone been able to solve the liimitations of the proxy generator? For instance, when the “extension” element is used or when recursion is defined.

    Do i need to use the SOAP framework to solve this problem?

    Any help would be greatly appreciated.
    Best regards
    Marcus

    (0) 
    1. Thomas Jung
      I can’t say that I have encountered these particular situations. We did hit a WSDL defintion generated by .Net that SAP could not consue.  .Net had used xsi:nil=”true” inside complex Structures.  I found some documents on IBM’s website about interoperability between WebSphere WebServices and .Net.  The tips given here seem to apply well to the SAP environment.  We made the changes suggested on the .Net side and then were able to consume the WSDL file just fine.

      If you can’t find such a solution, I might suggest that you open a problem with SAP.  You might just find out that the ABAP Soap runtime doesn’t support such structures. On the other hand, this might make SAP aware that such features are required by their customers.

      (0) 
    2. Venkat Marni
      Marcus Raath,

      Did you get any solution for this problem as I am exactly facing the same problem(I have some extension tags in my wsdls).

      I am glad to know if you get any kind of solution waither from SAP or anybody else.

      If you get any efficient and quicker solution for this problem please send me that to venkatmarni@gmail.com

      thanks in advance.

      Regards,
      Venkat Marni

      (0) 
  2. Jan Hempel
    Hi Thomas,

    thanks for this great weblog! It really helped me to get started in this matter.

    Unfortunately I receive an error when testing the generated proxy (using the “test-functionallity” in SE80). I get a “SaupFaultCode:1” with the following error-text:

    Found 0 operation definitions using keys:
    Key name:’first-body-element-ns’
    key value:’urn:EdilogUserManagementWebserviceWsd/EdilogUserManagementWebserviceVi/document’;
    Key name:’SoapRequestWrapper’
    key value:’getDisplayName’;

    Do You have an idea whta might cause this error?

    Thanks in advance, Regards
    Jan Hempel

    (0) 
    1. Thomas Jung
      It sounds like there was a badly formed SOAP message.  What is the other system that you are trying to call?  Perhaps turning on trace for this WS Proxy will yield more details.
      (0) 
      1. Jan Hempel
        Hi Thomas,

        the webservice is running on one of our SAP-J2EE, I have written it by myself. I have tested it with the testing-tool of the Netweaver-Developer-Studio (which I used to create this weservice), and it is working fine there.

        I followed Your suggestion with the tracing. Basically two things are conspicious:

        After sending the soap-message to the server I receive an internal server error:

        XRFC> INFO 09:22:52: SOAP HTTP Binding CL_SOAP_HTTP_TPBND_ROOT->HANDLE
        XRFC> _STATUS_CODE() Received return code 500 ( Internal Server Error )

        The soap-message which is then received from the server says that there is a security-exception:

        com.sap.security.core.server.ws.service.WSSecurityException

        Starnge thing, because I did not set up any security-settings for the webservice when devolping it. It has no Authentication, no Authorization.

        Regards
        Jan Hempel

        (0) 
        1. Jan Hempel
          I solved the problem “accidentally”: The name of the Webservice was to long! Changing the name from “EdilogUserManagementWebservice” to “UserManagement” did the trick.

          This is probably due to the restricted fieldlength of ABAP-programnames.

          Regards
          Jan Hempel

          (0) 
          1. Thomas Jung
            That is excellent. However you might want to still open this as a problem with OSS.  I don’t believe there should be a restriction on the name of the WebService.  It was my understanding that a name mapping should be created in the proxy.  There might be a problem that SAP can fix here so that others don’t hit the same problem.
            (0) 
  3. Xuesong Li
    Hi Thomas,

    Thanks a lot for the weblogs! It’s really helpful. But I come to a situation that I need to create an abap client to consume some stateful web services, which I implemented by JAX-RPC. In java, JAX-RPC requires client to special stub property. How can I do that in abap?

    In general, how to create and consume stateful ws in abap?

    Thanks a lot!

    Song

    (0) 
    1. Thomas Jung Post author
      I have never actually had the opportunity tot work with a stateful web service, however the process should be rather simple.

      After you generate your proxy client, you should go to the preconfiguration tab.  On this tab you can set your stub properties (such as authentication, transport guarantee, message id, etc).  On of the options is for Session-Oriented Communication.  You should just have to select this feature and activate the proxy.

      (0) 
      1. Xuesong Li
        Hi Thomas,

        Thanks a lot for your reply. I did set the session property as Session-Oriented Communication. But it still works as stateless. I found another place need to set is in creating Logical Port. It seems I need selecting the State Management checkbox activates state management by means of http cookies. Dose it make sense to you? then there is a problem is that it only work with choosing HTTP destination in Call Parameters section. Then my question is: how can I change from url to HTTP destionation? I can’t create http destionation for my url of wsdl file, since it’s a query string.

        Thanks a lot!

        Song

        (0) 
        1. Thomas Jung Post author
          Your correct.  That makes sense that you would have to setup the Logical Port as well.  Everything you setup in the Proxy is just a minimum requirement.  The actual setup must be done through the logical port – it is the same way with the security requirements.

          I’m also not suprised that you must setup an HTTP destination.  Anything beyond a basic anonymous setup generally requires an HTTP destination. 

          As to setting up the HTTP destination – have a look at the following weblog:

          Calling WebServices from ABAP via HTTPS

          In it, I just took the URL that had been stored in the Logical Port and broke it up into the separate fields of the HTTP Connection.

          (0) 
          1. Xuesong Li
            Hi Thomas,

            Thanks for your reply. It’s very helpful. Following your instruction, I regenerated the client proxy with session feature checked and setup the Logical Port with state management and Http destination. But it still doesn’t work statefully.
            My abap code is trying to consume a email WS, which is stateful to keep a mail session alive as long as the user doesn’t close it. In my abap client side it seems still working stateless as:
              after “CALL METHOD mail_proxy->open_mail_session” to open a mail session, the “CALL METHOD mail_proxy->open_mail_store” throws an exception: “ICF Error when receiving the response: HTTP COMMUNICATION FAILURE”.

            Do you have any idea about it? Is it still the client proxy or logical port stateful setting problem?

            Thank you very much!

            Song

            (0) 
  4. Vincent Pontrandolfi
    Hi Thomas,

    Thanks a lot for the tutorial about webservices, I was able to create a client proxy based on the XI Repository but when executing the generated method I always get a popup for entering user and password. The popup has following info

    Resource   XISOAPApps
    username   …..
    password   …..

    Is it possible the define a default user & password? Or determine the user & password at runtime?

    The sap system I use is a 2004s

    Thanks a lot,
    Vincent.

    (0) 
    1. Thomas Jung Post author
      Yes, what you can define a default user & password.  You need to go into the logical port for the webservice.  In the logical port you will change the call parameters to use an HTTP Destination.  You can then use SM59 to create this special desintation type.  You have options for basic authentication, HTTPS, Logon Tickets, Client Certificates, etc.  Here is a weblog that shows many of the screens that you will need:
      Calling WebServices from ABAP via HTTPS
      (0) 
      1. without SM59, is there any other alternative to give username and password for the webservice consumption .
        Is it possible to give this information in the client consumption program itself ?
        (0) 
        1. Thomas Jung Post author
          Nothing that I know of.  SM59 destinations are the primary solution for security setting defintions in services.
          (0) 
  5. Hi Thomas,

    I came across this blog and wanted to use it in one of the scenarions in our project. I am trying to get stock price by consuming a web service but I get the error when I try to do it.

    HTTP error (return code 400, message “ICM_HTTP_CONNECTION_FAILED”)

    I tried the same books example to start with. Is there any setting which needs to be done before I can use this?

    Thanks,
    Kiran

    (0) 
    1. Thomas Jung Post author
      If you system is behind a firewall (as is the case at most companies), make sure to setup your proxy settings in transaction SICF. This is under menu option Client->Proxy Settings. 

      That is usually the most likely suspect.  However you might check the HTTP logs (transaction SMICM) to see if they have more details.  A 400 HTTP error according to the w3.org is a Bad Request:
      10.4.1 400 Bad Request
      The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
      http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

      (0) 
      1. Hi Thomas,

        When I go to the SICF transaction and to client proxy config, I see two check boxes

        1. Proxy Setting Active
        2. No Proxy setting for Local Server

        None these are ticked, and below these two I see a table which says
        “No proxies for the following addresses”  where I can enter entries which can be filtered from proxy settings…

        If I enter my webservice in those filter address, will it solve the problem? Or what exactly should I configure here?

        The other option I have is to download the WSDL file and upload it into WebAS. How can I download the WSDL? When I tried doing that it gave me error saying “text format not allowed”.

        Thanks,
        Kiran

        (0) 
        1. Thomas Jung Post author
          When calling a web service, your ABAP server is acting as an HTTP client.  It will need the same proxy settings that your browser requires on you PC to access websites.  I can’t tell you what to configure in this area, because it is specific to how your company’s network and firewall are setup.  You should speak to the people at your company that control those settings for your browswer. 

          As far a downloading the WSDL file, that depends upon where you are getting the file from.  Different sites will have different mechanisms.  I ususally view the WSDL file in my browser (it is just XML) and the do a Save As to get the file local. However loading the WSDL file locally, isn’t going to help you get around your proxy problem.  The WSDL is just the service definition, you still need to pass through the firewall when you make the Web Service call itself.

          (0) 
          1. Thanks Thomas. This information clarifies some confusion I had…thanks for this great blog, I did a search to find all the blogs on publishing/consuming webservices from/thru ABAP and looks quite powerful.

            Thanks
            Kiran

            (0) 
    1. Thomas Jung Post author
      Changing the WSDL is almost never the answer to correcting a proxy generation problem.  The WSDL is a description of how the webservice will work at runtime.  If you change the WSDL alone, you haven’t actually changed the web service itself. 

      This might get your proxy to generate, but then what happens at runtime. The proxy class encounters something different than what it expected – since the source webservice hasn’t changed.  That is exactly the situation you have here – the proxy doesn’t match the web service it is calling and therefore produces an error.

      If the source Web Service is structured in such a way that you can’t generate a proxy for it, then you can’t expect to call it at runtime.  You need to change the source webservice settings, not just the WSDL defition of the webservice.

      (0) 
      1. Benjamin Hindelang
        I concede that changing the wsdl was not the best way.

        The webservice settings can’t be that wrong, because the the nwds webservice test tool copes with it and even a simple java client is without any problems able to call the service. But in both ways I’ve got a support for rpc encoded wsdls. Obviously, as mentioned in some sdn forums, r/3 does only support document/literal but not rpc/encoded wsdls. So if I can’t do anything at generation time, I have only two possibilities left:
        1. not using soap with attachments but simple soap and having a large amount of bytes in my soap body.
        2. making an rfc call to ejb which provides the webservice.

        Both ways are not really what I wanted to do, but if there’s no other way.

        Maybe you have another solution for my problem.

        Regards,
        Benjamin

        (0) 
  6. Hi Thomas,

    First of all, I’d like to thank you for all your very comprehensive blogs about this subject, they’ve helped me so much.

    I’ve followed this page step by step (the 6.40 part) in order to consume an external Web Service. The WS I’m using is a very simple one I found on xmethods, ‘Quote of the day’, which requires no input (minimizing the areas I might make a mistake in…)
    At first I had a connection problem (HTTP error 400, which many have had) which I’ve fixed by entering all the correct proxy info.
    Now, after I’ve created the client proxy, created the logical port for it, and activated both, I test them just as you suggest by hitting F8.

    This is where I’m stuck, I get an ERROR_WEBSERVICE_RUNTIME_INIT error message. I’ve tried looking up this error, and have found nothing on SDN, google, or CSS notes. I was wondering if you’ve ever encountered this problem and if you know what the reason for this error is?
    I’ve tried it with other webservices (to see if the error is maybe due to the WS itself?) and have gotten the same error, so I guess the error is coming from my side…
    I’d like to find out if the error is due to something I might have done wrong while creating the proxy object (I won’t bore you with the details of my step by step procedure unless you’re curious) or whether this error indicates to some wrong settings in my system, or maybe some missing building blocks? I have no clue …

    Thanks in advance,
    Micol Lazar

    (0) 
    1. Thomas Jung Post author
      I can’t say that have ever seen ERROR_WEBSERVICE_RUNTIME_INIT.  It sounds like a rather generic exception however.  I also didn’t find anything CSS or SDN on that error. 

      I would suggest two things.  First turn on trace for that logical port and try and run it again. The trace will hopefully give you a better description of what is going wrong or at least where it is going wrong. 

      Also have you tried consuming a webservice from the J2EE stack or even from the same ABAP system?  This would give you an even more controlled enviornment. 

      You final option is to go ahead and open a support issue with SAP on the issue.  They can connect to your system and see exactly what is going on. 

      (0) 
    2. BRIDE Philippe
      Hi,
      I’ve applied the process on WAS640 and I’ve got the same error message when testing the WS.
      “…
      ERROR_WEBSERVICE_RUNTIME_INIT
        Error when instantiating WebService runtime (Error when initializing SOAP client application )
      …”
      Please help if you succeed in going through.
      Thanks.
      Philippe
      (0) 
    1. Thilo Suelberg
      Hi all,

      I found a workaround for that specific problem. When debugging the ABAP code I discovered a bug that causes this error. The framework cannot handle
      tags correctly. When using complexTypes, it works fine. I will open a CSN note for that issue.

      Best regards,
         Thilo

      (0) 
    2. Thomas Jung Post author
      I have been sent similar proxy generation errors from other users in the past and they all seem to originate from JBoss systems.  That makes me think there may be some incompatibility with the default web service definition generation in JBoss and the ABAP proxy generation.

      Your inquiry should be turned in as a formal support ticket however so that they can determine if this is a problem with the proxy generation on the ABAP side.

      (0) 
  7. GLT GLT
    Hello,
    My SAP version is 6.20 and i use your example to access an http web.
    Can you help me to describe the connection type ‘G’ in the SM59?
    Thanks for your help.
    Géraldine LAVENANT.
    (0) 
      1. GLT GLT
        I see on the documentation in the exception “http_communication_failure = 1” with the method “Receive” : I need a connection type G, doesn’t it ?

        Can you help me on this exception .
        Thanks .

        (0) 
        1. Thomas Jung Post author
          I’m afraid that I’m still now sure what you are asking for. You do normally use a connection type G for HTTP connections to any non-ABAP system.  Connection type G allows you to specify the connection parameters as well as the type of authentication.  If the HTTP service you are calling is outside your network, you might also have to maintain the Client->Proxy Settings in transaction SICF.  This is where you specify the settings specific to your network for passing through an Internet Proxy or Firewall. 
          (0) 
          1. GLT GLT
            Hello,

            Thanks for your help : The subrc equal 0 now.

            Other question : I Get the response content in Character format but can i have an XML document in my version 6.20

            (0) 
            1. Thomas Jung Post author
              > I Get the response content in Character format but can i have an XML document in my version 6.20

              Your going to get whatever format the response body was sent in.  If it is actually XML in a character string then just use the iXML library to import the stream and then you can process it as XML.

              (0) 
  8. GLT GLT
    Hello,

    My version SAP is 6.20.
    Can i receive a pdf file to an external application HTML? I want to receive the pdf file and i want to save the pdf file in a change document (CV01N).

    Thanks a lot.

    (0) 
    1. GLT GLT

      I receive the xml document :<br/>—-


      <br/> <?xml version=”1.0″ encoding=”UTF-8″ ?> <br/>- <resultatCalculPrix><br/>- <codeRetour><br/>  <code>0</code> <br/>  <message>tout va bien</message> <br/>  </codeRetour><br/>  <prix>140.47</prix> <br/>  <structureFormulePrix>JVBERi0xLjQKJeLjz9MKNSAwIG9iaiA8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvVHlwZS9YT2JqZWN0L0xlbmd0aCA5NDEvQml0c1BlckNvbXBvbmVudCA0L0hlaWdodCA1OS9Db2xvclNwYWNlWy9JbmRleGVkL0RldmljZVJHQiAxNSj1ztb99PbbUm3GABfTLE3tqLXJBCPic4j76u3plabOFDbxucTlgZX43OHKACf///8pXS9TdWJ0e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3MiAwMDAwMCBuIAowMDAwMDA1MzAzIDAwMDAwIG4gCjAwMDAwMDMxNzYgMDAwMDAgbiAKMDAwMDAwMzM4NCAwMDAwMCBuIAowMDAwMDA0NDQxIDAwMDAwIG4gCjAwMDAwMDUzNjAgMDAwMDAgbiAKMDAwMDAwNTQwNSAwMDAwMCBuIAp0cmFpbGVyCjw8L0lEIFs8MDZlMzViODNjNjVmNzZmOWRhN2Y4ODBkZGM4MDAxNzYPDU3NjNkNzc0MmUyZWJjYTdkMTZkMzQyOTM3ZjA3MzIxPl0vUm9vdCAxMSAwIFIvU2l6ZSAxMy9JbmZvIDEyIDAgUj4CnN0YXJ0eHJlZgo1NzUzCiUlRU9GCg==</structureFormulePrix> <br/>  </resultatCalculPrix><br/><br/>
      —-


      <br/><br/>In the resultatCalculPrix>, i want to receive a path or file pdf.<br/>how can i receive the file pdf from an xml document?

      (0) 
      1. Thomas Jung Post author
        Well we are really quite far off from the original topic of this blog now.  You have your service returning XML, but questions are more centered on manualy processing the XML, working a binary field and updates CV04N (really far off topic).

        I’m not sure why you would want to receive a path and filename when it looks like you already have the full PDF in the XML?  The binary content of the XML file is in the field structureFormulePrix.  You just need to pull this out of the XML (I suggest using the iXML classes) and then you can process it as you see fit.  As far as processing it into CV04N – like I said that is very application specific and very far off topic.  I suggest you ask that question in the ABAP forum.  As I remember the Document Management system has some BAPIs, but the coding is also dependent upon if you use the SAP Content and Cache server in conjunction with CV04N.

        Oh and in the future it really isn’t necessary to post the entire binary string of the XML into the comments.  Most blog authors get their comments via Email – that created one heck of big email that my blackberry had problems dealing with. 🙂

        (0) 
    1. Thomas Jung Post author
      Sure it is quite simple.  The logical port is an optional parameter of the constructor of any proxy class. Therefore in this example I had originally had the code:
      CREATE OBJECT lo_clientproxy.

      If I wanted to supply the logical port name at runtime, I would just change this code to:

      CREATE OBJECT lo_clientproxy
        exporting
          LOGICAL_PORT_NAME = LPORT.

      LPORT would need to be a variable of type PRX_LOGICAL_PORT_NAME and contain the name of an existing logical port that had already been configured in LPCONFIG.

      (0) 
  9. Hi Thomas,

    Thanks for a great bolg. It really helped me to learn in how to consume a webservice.
    As of now I am facing an error when calling a method from the webservice. Following is the error ‘Index was outside the bounds of the array’. Can you please tell me why this error is coming and is it from SAP end.

    Thanks in advance for your help.

    (0) 
    1. Thomas Jung Post author
      That doesn’t sound like an error that would be coming from the ABAP side – at least that I have encountered; but it is really difficult to say.  It could just be a violation of the syntax of the XML schema of the service or it could be coming directly from the application of the service host.  Is this error coming from a SOAP Fault?  Have you turned on logging and trace to see if you can narrow down the source of the error?  Do you only get this with one service?  If so do you have access to the source of the service and can you debug within it?
      (0) 
  10. Abid Velshi
    Hi Thomas,

    Great tutorial.

    I was wondering if you know whether it is possible to use a DTD file as opposed to a WSDL file in your second example (Release 6.4). Do you have a similar solution that would consume a webservice using a DTD file?

    Thanks in advance.

    (0) 
    1. Thomas Jung Post author
      No it can use a DTD file.  I believe that the WSDL being the source definition for Web Services is pretty much industry standard.  The DTD and WSDL serve very different purposes.  Where a DTD is concerned with data structures, a WSDL must describe much more than that – it must define the full interface (operations and such) for the service.
      (0) 
  11. Abid Velshi
    Hi Thomas,

    I have run into another error while trying to consume a WebService that was created in .NET.

    When I test the service, I get the following error message:

    SoapFaultCode:2
      Wrong SOAP Version

    This is a little strange, since I previously created a different webservice in the same manner and did not run into any errors while consuming it.

    Do you have any ideas?

    Thanks in advance.

    (0) 
    1. Thomas Jung Post author
      I have never seen the Wrong SOAP Version error.  It makes me think there must be something wrong with the service definition on the .Net side.
      (0) 
  12. Mark Bailey
    Hi Thomas thanks for a very useful and informative weblog.I am currently working for a client where I need to consume web services through ABAP.I followed all your instructions and everything is working fine (well almost).With some of the methods I get the following error :
    Error during XML => ABAP conversion (Response Message; error ID: CX_ST_GROUP_MISSING_CASE; (/1SAI/TXS00000000000000000005 XML Bytepos.: 3013  XML Path: root(1)ns1:getEmployeeByPayrollCompanyResponse(1)ns1:result(1)ns_level1MgmtOrg:level1MgmtOrg(11)

    What is strange is that I seem to only get the error when certain data get returned but for other data I do not get this error, please tell me what this error means and if this is a error on the web services side or on my side in ABAP.

    Thanks for all your help

    (0) 
    1. Thomas Jung Post author
      From your description of the erorr it appears to be something wrong at the data/application level not a technical problem.  Where is this Web Service provided from?  You are getting the error during the Transformation from XML to ABAP and the path of the data is provided in the error.  You should probably directly contact the support for this service and provide more details (such as the data that causes the error, the data that works, etc).
      (0) 
      1. Mark Bailey
        Hi Thomas

        Thanks for your reply, we have determined the problem, it seems the ABAP conversion routine can not process NULL values in the XML tags.

        So I asked the service provider to exclude sending fields that have NULL values and this worked.

        (0) 
    2. Mark Bailey
      Hi Thomas

      I want to ask you a question please and hopefully you can point me in the right direction here.I am at a client and they are using ESS Portal so that their employees can update their personal data like addresses etc.My requirement is that I want to catch whatever the user changes in the portal in R/3 ABAP but I do not know how to achieve this.Maybe you can help me on that.

      Thanks in advance!
      Mark

      (0) 
  13. Mark Bailey
    Hi Thomas

    I want to ask you a question please and hopefully you can point me in the right direction here.I am at a client and they are using ESS Portal so that their employees can update their personal data like addresses etc.My requirement is that I want to catch whatever the user changes in the portal in R/3 ABAP but I do not know how to achieve this.Maybe you can help me on that.

    Thanks in advance!
    Mark

    (0) 
    1. Thomas Jung Post author
      I’m not sure how your question relates to the content of this blog.  I’m afraid that I have no experience with ESS so I’m not really qualified to answer your question.  I’m not really sure I completely understand your question since ESS has a Java UI, but an ABAP backend data changes are done in the ABAP HR system.
      (0) 
    1. Thomas Jung Post author
      The unsupported tag error makes me think that you used a feature in the Web Service creation that this supported by the ABAP Client Proxy Generation (there are few such features).  I would try and create a very simple web service and test it.  I also would ask the question in the SDN Forums.  You might be able to find someone who has directly experienced this error (I have not).
      (0) 
    1. Thomas Jung Post author
      If you want to adjust the headers you will need to look at the extended protocols:
      Web Services: The Case of the Missing SOAP Action Header
      I doubt that overwriting the response payload with the requestion one would work.  You would need to set the new URL directly.  However if I remember correctly from trying to work with SalesForce.com in the past – there is a set_url method but either didn’t work or wasn’t public – I can’t remember. 
      (0) 
      1. Anil Kakarla
        Hi Thomas,

        First of all thank you very much for your valuable time and quick response.

        You are correct I tried to set the url directly with “set_url” method in transporting binding (CL_WS_TRANSPORT_BINDING). This method doesn’t work.

          I have gone through your blog “The Case of the Missing SOAP Action Header” and tried getting the response payload(GET_SENT_RESPONSE_PAYLOAD) from WS protocol and set it to request payload (SET_REQUEST_PAYLOAD) of WS protocol. Do you think this should work?

        In this case, do you think the new url set in request payload will be used in further WS calls to salesforce?

        Could you please help me pointing any documentation/help on request/response protocol payloads.

        Thanks,
        Anil

        (0) 
        1. Graham Robinson
          Hi Anil,
          when I was using SalesForce.Com I used the enhancement framework to modify the set_url method so that it worked. I think from memory the correct codeing was commented out. The change was only a line or so.
          Once I had fixed this method it all worked fine.
          Cheers
          Graham Robbo
          (0) 
  14. Hi Thomas,

    Thanks a lot for the clear explanation. However, when testing the webservice, I don’t receive a success message but:


      Local
      ERROR_WEBSERVICE_RUNTIME_INIT
      Error when instantiating the Web service runtime (Logical port ‘MY_PORT’ for proxy class ‘ZTEST_SERVICE’ is not active )
     

    What might be the problem?

    (0) 
      1. Hmm, still not working. This ne doesn’t seem as simple as the previous one. I see no references to ‘error_text’ anywhere else.:

        (0) 
        1. Thomas Jung Post author
          I’m afraid that error: “error_text” isn’t much to go on.  About all we can tell is that it is in the initialization of the runtime itself.  So the error is likely on the ABAP side.  I’m afraid that with the true error text not being reported, turning on logging is your only solution.  You will need more details about the error, otherwise I would suggest that you double check all your setup.
          (0) 
          1. Thanks for the answer. However, I’m pretty new to SAP, could you explain or point me to a document how to view those log files?
            (0) 
                1. Thomas Jung Post author
                  The operation and the URLs should all come from your source WSDL document.  Such an error would lead me to believe the WSDL is not correct.
                  (0) 
          2. By using the debugger, I think I’ve managed to find the exact error:

            There is raised an exception of type CX_SOAP_CORE:

            E_TEXT = SRT: Invalid settings in Web Service Registry detected
            E_ID   = 1019
            E_FAUL_LOCATION = 1

            (0) 
  15. Alejandro Bindi
    As always, thank you Thomas for this valuable information.

    As a way to give back I wanted to post here a tracing tip i’ve discovered for WS client debugging purposes, which is an (easier?) alternative to activating tracing in LPCONFIG and then checking system logs:

    If you go inside method CL_PROXY_FRAMEWORK->WS_CALL_OUTBOUND( ) -which is called by the client proxies-, you’ll see there (among other coding) this method calls:

    ws_process_payload( ). <– This creates the XML request payload
    ws_process_call( ). <– This invokes the service
    ws_process_payload( ). <– This receives the XML response payload

    Now, if you put a breakpoint inside method ws_process_payload( ) you’ll see there’s a local variable L_SHOW, set that to ‘X’, and when you hit F7/F8, the XML payload gets shown on screen in a nice XML editor.

    I’m just beginning with web services and this discovery is helping me a lot while troubleshooting, hope it helps others as well.

    Regards

    (0) 
  16. Nicolas AURIGNAC
    Hi,
    This is a very useful weblog that I have tried to implement for a POC.
    I was using SAP ECC 5. The proxy generation form the WSDL file is just fine, but the soap request sent from the sap server is wrong…

    The WSDL defines an operation AAAA with input and output message types. In the soap request, it is the input message that is called and not th operation…

    This is the SOAP request that is generated :




    Full

    uuid:484E89A8-5A5C-0214-E100-80000AFFFACA










    can anyone help ???

    Nicolas

    (0) 
    1. Nicolas AURIGNAC
      Hello Thomas,
      I have still got the problem of the soap request that is wrong.
      Have you any idea of how I can find out why request is wrong. I have debugged the call and even when changing data manually before the actual SOAP call, the request is wrong…

      Thanks for any help you can provide.
      Nicolas.

      (0) 
      1. Thomas Jung Post author
        I don’t know how I can help you. If you feel that the generation of the web service is happening incorrectly then you should enter a support ticket.
        (0) 
        1. Nicolas AURIGNAC
          Hi,
          Thank you Thomas for the reply…
          The solution to our problem is a support package… We were in SP12 on ABAP Basis. I have tested on a SP14 system and the Soap message is OK…
          I hope this will help others…

          Regards,
          Nicolas

          (0) 
  17. Snehasish Das
    Hi Thomas,
    i followed your blog and created abap proxy.then i used the method of the class generated in proxy for extraction program.But when i tested it in i am setting Exception(In tranx:SM21) saying:SOAP Runtime Protocol: SOAP Fault exception occurred in program CL_SOAP_RUNTIME_ROOT==========CP in include CL_SOAP_RU NTIME_ROOT===
    ==========CM004 at position 80.
               Please suggest me wht kind of exception is this and is it related to XSD type.

    thanks
    Snehasish Das

    (0) 
    1. Thomas Jung Post author
      There isn’t enough info to go on.  To say you are getting a SAOP Exception is like say you got a short dump, but not providing any of the other details.

      SOAP Exception just means that something went wrong. You need to provide the details listed along with the SOAP Exception before anyone will be able to help you. 

      (0) 
      1. Snehasish Das
        Thanks Thomas for the reply.The error text i am getting in exception CX_AI_SYSTEM_FAULT as below:
        “Cannot figure out operation name. Bad SOAPAction or wsa:Action.”

                     When i tested the created proxy ,it always hangs.

        Thanks
        Snehasish Das

        (0) 
        1. Thomas Jung Post author
          It sounds like the SOAP layout of the sender is not correctly formatted.  If you are positive that the source system is correct, then you can enter a support ticket to see if it should work via an ABAP Proxy. 
          (0) 
      2. Snehasish Das
        and one more information SOAP Action is there in Web Service.Still i am getting same error saying:
        “Cannot figure out operation name. Bad SOAPAction or wsa:Action.”

        Thanks
        snehasish

        (0) 
    1. Thomas Jung Post author
      Well you are getting HTTP Communication Failure so that is like getting a 404 message when using your Internet Browser on your client. Basically your server can’t reach the server with the web service. 

      Have you checked via your PC/browser to see if the URL listed in the WSDL is actually reachable?  Is the service outside your firewall?  If so, you probably need proxy settings (just like on your client machine).  Proxy settings can be maintained within transaction SICF.

      (0) 
  18. Michael Kretz
    We are using a NW 7.0, SP14 and want to consume webservices from a 3rd party Java application.
    The ABAP client proxy was generated successfully.
    On Proxy-Test and selecting a method, an error message comes back.
    It turns out that the receiver cannot understand the SOAP header which is sent.

    We also tested with an external test application (soapUI), where the service can be called qithout any problem.

    It seems that the receiver has some problems with header tags like
    http://conterra.de/waage/InitMapSessionhttp://janus2.bsh.bvbs.bund.de:8080/axis2/services/MapClientWS

    My question is if the ‘MustUnderstand=1’ can be removed. Is there a configuration?
    The second one is if the header is correct at all.
    If you look at the Action definition (n2) the action http://conterra.de/waage/InitMapSession is a little strange, since it consists out of the namespace http://conterra.de/waage and the operation name ‘InitMapSession’.
    How should this action be interpreted?

    Can I configure the webservice runtime in a way that these header data are not sent?

    Thanks,
    Michael

    (0) 
    1. Thomas Jung Post author
      I’m afraid that I don’t have much help to offer you.  Your saying that the 3rd Party Java doesn’t understand SAP’s SOAP Request becuase of the Headers in it, correct?

      Do you know for sure that the mustUnderstand is the cause of the problem.  mustUnderstand does appear to be a valid element:
      http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383500

      In SOA Manager did you use WDSL based or manual configuration of the logical port?

      (0) 
    1. Thomas Jung Post author
      It looks like an exception was thrown within the application logic itself.  The exception – CX_ROOT – doesn’t tell us much since that is the generic catch, all exception.  I would check in ST22 and see if there is a short dump associated with this error.  that will give you details on why this error is occuring.
      (0) 
      1. Lakshman Balanagu
        hai thomas jung
        thanx for ur reply..
        I checked the ST22.it contains no errors..
        and another issue is
        if my proxy’s contain the errors(cx_root)
        When I call the methods in a function module they executed successfully..
        Is there any problem in future???????

        wait’s for ur reply..
        lakshman

        (0) 
        1. Thomas Jung Post author
          I’m farid there isn’t much more I can do for you via a blog comment section with only the description of CX_ROOT.  You should consider using the offical support channel, especially if this is an SAP Service or Function Module you are wrapping. 

          (0) 
  19. JOEL VELDERS
    While doing initial testing on a new proxy this error appears but with some digging I have found a more meaningful message:
         A SOAP Runtime Core Exception occurred in method configure_features of class CL_SOAP_APPLICATION at position 32 with internal error 1019 and error text SRT: Invalid setting in Web Service Registry detected (fault location is 1).
    The feature it is working on is http://www.sap.com/webas/630/soap/features/transportguarantee/ and the property is null. It needs to be either “Level” or “TlsType” or the error is produced.
    Can you tell me if this is a problem with perhaps the WSDL, or an SAP product error, or something else on the server side?

    Testing the proxy site, a simple validation app, with my web browser is successful.

    Thanks.

    (0) 
    1. Thomas Jung Post author
      This error leads me to believe that there is some configuration mismatch.  It appears as though the service requires a Transport Guarantee setting higher than none, but nothing has actually been configured for this service.  This probably means that there is a security setting spelled out in the WSDL that isn’t met by the current configuration.  It could also point to a mismatch in the security settings from the sending side.  Without studying the setup of both the service definition and the proxy it is difficult to say which. However the feature – transportguarantee helps significantly to narrow down where the problem is. I would suggest looking at the settings around the Transport Guarantee on both sides to see where the mismatch is.
      (0) 
      1. Brian Fernandes
        Hi Thomas,
          I am no expert in proxies or when it comes to runtime environment of Services.

          Am using ECC 6.0 & CE 7.1 EP06
        I have a Composite Application(CAF, using Java) which consumes BAPIs and Enterprise Service.
           For connecting the CAF(Java) layer to communicate with ECC I need to perform mapping between the destinations of the BAPI(RFC destination) and the Web Service destination.
           For authentication, in the case of RFC destination I have used the assertion ticket and is working fine. But for the Web Service Destination, when I try using the Logon Ticket I get the error
        ” Error while creating assertion ticket on demand. No logged in user found. “

          and when using the Logon Ticket I get this error
        ” Properties not set:
        NS: http://www.sap.com/webas/630/soap/features/transportguarantee/ Name: IncludeTimestamp “

        Please help me in this issue. Any information is appreciated.

        Thanks Brian

        (0) 
        1. Thomas Jung Post author
          Your questions isn’t really directly related to the content of this blog.  I can’t scale to have my blog comments just become an alternative SDN forum for anything Service Oriented related. I suggest that you ask your question in the appropriate SDN Forum.
          (0) 
  20. Jiannan Che
    Hi Tom,

    I just started to play with the ABAP service consumer proxy.  I am using it to call a web service in a .Net server on my company’s intranet.  I am facing the problem with the authentication.  When testing in the SOAPUI tool I need to enter the username, password, and the domain.  I could also enter the domain like domain\\username.  It worked fine either way in SOAPUI.  When I tried to call the service through an ABAP consumer proxy in an ABAP program it did prompt me for username and password but not the domain.  I entered domain\\username and password but got the 401 unauthorized error.  The .Net server and the SAP server running the ABAP proxy and program are all on the same domain. 

    I have searched in SDN and google without much luck.  Can you please provide some idea on how this can be resolved or where I can find more information?  Thanks.

    Regards,
    Jiannan

    (0) 
    1. Thomas Jung Post author
      ABAP is just conforming to HTTP basic authentication.  It will place whatever you enter in username and password into the http header fields. The rest is up to how the receiving side handels the basic authentication. Internally at SAP we never enter the domain when doing such basic authentication. It is just your windows username and password. 
      (0) 
    1. Thomas Jung Post author
      You are getting an HTTP connection failure, so you will want to look at the ICM trace logs to determine what is actually causing this.  Most likely candidate is generally that you need to set configuration for your Firewall if this service is outside your network. This can be done from transaction SICF, Client->Proxy settings.

      If this isn’t the case, then the service might actually be unreachable – hence an invalid URL or the authentication might be incorrect.

      (0) 
    2. Abou-Zeid Gerdi
      Hi Thomas,

      Below is my thread Posted: Apr 8, 2009. Still without answer. I think I don’t need to create any Webservices – I’m not sure for this! Please help me to solve my problem exchanging xml file via https. We have in the company Netweaver, so there is the posibility to use xi. We don’t provide BSP Applications. I tried with an abap report: /community [original link is broken], which was failed!

      Which configurations must be done for a correct comunication via https.

      My Thread:
      I try to send/receive files via HTTPS. To send and receive files to/from the Server my script must include the following steps:

      1. Open an HTTPS connection to Server using the URL that describes the action (send, retrieve, etc.).
      2. Send the necessary HTTP headers.
      3. Send any data needed for the action.
      4. Read the answer from Server.
      5. Close the connection.

      To open the connection I would like to use:

      HTTPS.Open(“http://www.xxx.com?user=xxx&password=xxx&action=send&rdquo;)

      Which Server (SAP Netweaver) configurations are necessary to get the connection?

      Regards

      (0) 
      1. Thomas Jung Post author
        I’m not sure I understand how your quesiton is related to this blog. You don’t want to use Web Services and you aren’t using BSP.  I’m not exactly sure what you are asking to setup or use.  If you just wnat to know how to configure your server for HTTPS, then read the security guide on HTTPS setup.

        You have to have something that you are connecting to on the sever – a service handler, a BSP application, a webservice.  This isn’t a file server you are talking to.

        Also if this is a thread from the forum, then it would courteous to at least provide a link to that thread. 

        (0) 
          1. Thomas Jung Post author
            Check the ICM log (in transaction SMICM) for the possibility of more details on the error. Generally thought, such an error would be related to the incorrect specification of the URL or not having maintained the proxy settings in transaction SICF.  Without proxy settings, you can’t get past your corporations firewall to reach any external servers.
            (0) 
            1. Abou-Zeid Gerdi
              Hi Thomas,

              Thats waht I get as from the ICM Monitor:
              [Thr 5540] *** ERROR => NiBufIConnect: non-buffered connect pending after 5000ms (hdl 9;www.w3schools.com:80) [nibuf.cpp    4611
              [Thr 5540] *** WARNING => Connection request from (21/13936/0) to host: http://www.w3schools.com, service: 80 failed (NIECONN_REFUSED)
              RM-T21, U13936, 040 AGI, localhost:0, 14:53:46, M0, W1, SEU_, 4/2 {000321e0} [icxxconn.c 2321]

              (0) 
                  1. Thomas Jung Post author
                    If you are saying that you haven’t maintained the settings, then that would be a strong candidate for the source of your problem.  By proxy, I mean firewall proxy – not web service proxy.  

                    Go to transaction SICF. Execute to get the service node hiearchy.  Then choose Client->Proxy Settings from the menu. Maintain the settings according to the demands of your network.

                    (0) 
                    1. Abou-Zeid Gerdi
                      Hi, I have now made settings for client-proxy in ICF. I don’t get the connections error any more!

                      But I also don’t get the requested file.

                      Perhaps you tell me about this error?
                      “The requested URL could not be retrieved… Access Denied…”

                      But the URL: http://w3schools.com/Xml/note.xml is public and doesn’t need login.

                      (0) 
                      1. Thomas Jung Post author
                        Well you are getting Access Denied from somewhere.  My guess is that your proxy settings are perhaps incorrect and the proxy authentication is failing.  If the website is truely anonymous then the proxy is the only thing that would be requiring access.
                        (0) 
                  1. Thomas Jung Post author
                    I can’t help you with the actual settings, as they would be specific to your corporation.  You should discuss this with you network administrators.
                    (0) 
  21. Upendra Agrawal
    Dear Thomas,
    Thanks for such a wonderful blog.
    I am having problem in consuming a Internet webservice. I am getting the following error
    404 connection failed.

    when i go to the message information it says to maintain the proxy settings.
    In SICF>Client>proxy setting
    Now I am really confused that which settings I have to make there.

    Like what host name and the etc, and where to get them all

    Kindly Suggest.

    Warm Regards

    Upendra Agrawal

    (0) 
    1. Thomas Jung Post author
      You need to put in the settings for your corporate network’s Internet Proxy/Firewall.  These are the same settings that you will find in your Internet Browser for connecting to the Internet.
      (0) 
  22. Tomas Toth
    Hello,
    we try to do the same on new NetWeaver 7.0 ENH1, where are all stuff regarding SOA and WS upside-down.
    Right now we are stuck with a problem, how to set up a LogicalPort for Client proxy to connect to WS via HTTPS with authentication via client certificate. Simply there is NO field to mark “use X.509 certificate” for authentication.

    Do you have any experience with new SOAMANAGER in this matter ?

    Thank you in advance.
    Best regards
    Tomas

    (0) 
  23. Sumeet Nag
    Hi Thomas,

    This is a very helpful blog.I am trying to consume a web service in abap.
    Here is the piece of code which does the job:

    data: proxy type ref to ZPM_ESRICO_LOCATOR_HUB_SOAP,
          input type ZPM_ESRIMATCH_SOAP_IN,
          output type ZPM_ESRIMATCH_SOAP_OUT,
          exception type ref to CX_AI_SYSTEM_FAULT,
          data type string.

          data = ‘High Street Glasgow’.
          input-MATCHER = data.

           create object proxy.
           TRY.
           CALL METHOD proxy->match
             EXPORTING
               INPUT  = input
             IMPORTING
               OUTPUT = output
               .
            CATCH CX_AI_SYSTEM_FAULT into exception.
            CATCH CX_AI_APPLICATION_FAULT .
           ENDTRY.

    When I execute it, I get a cx_ai_system_fault exception with error_text saying ‘Server was unable to process request. —> Object reference not set to an instance of an object’.

    (0) 
  24. Fabian Mena Miño

    Hi Thomas,

    After I created the client proxy I tested it and it worked but not perfectly. The web service I am consuming receives an XML file and returns a message with information about that XML file. The problem is that I am not getting that message back. I checked the data types created by the client proxy and some of them look like they were not created right. When I try to access to those objects I get the following error:

    • “Data Type ZCH_COMPROBANTE_TAB

              No proxy exists for object comprobante (namespace http://ec.gob.sri.ws.recepcion)”


    ZCH_COMPROBANTE_TAB looks like a table use for sending the information about the XML file back to us.  Please help me, I need any help you can give me.

    (0) 
    1. Thomas Jung Post author

      I wrote this blog in 2004. Much has changed about the web service tools since then.  I would strongly recommend that you post your question to one of the appropriate SCN forums instead.

      (0) 
  25. Prabaharan Asokan

    Hi Thomas,

    I am consuming Microsoft .NET webservice in ABAP but after completing the proxy wizard it results in error ‘No Vendor specified‘ error. I used report RSSIDL_DESERIALIZE_DEMO to test WSDL correctness. The report showed the exception like ‘ Incorrect value:Namespace prefix q1 of Qname q1 Exception is undeclared‘.Bu the same WSDL works and gets consumed in SAP system with higher Releases.Please advise .

    Your help is highly appreciated.

    Thanks

    Prabaharan

    (0) 

Leave a Reply