Skip to Content
author's profile photo Former Member
Former Member

URL rewriting for a WebService Consumer Proxy

Hi all,

Did anybody come across this issue?

I have a SAP System - let's call it "TM" - that I want to bind with another non-SAP one - let's call it "FB" - without any PI between them.

The communication is made as a Service Consumer (TM side), the Proxy (see image below) and Proxy-Implementation Class being generated automatically after the ".wsdl" file and the "url" given by the documentation of FB.

Everything looks good! All the Methods (operations) that are available from the service have been added to the Implementing Class.

After the Proxy generation, I also created the Logical Port (in transaction SOAMANAGER - see image below) where the path, host, prefix, and all the necessary stuff were also automatically created after the ".wsdl" document.

So far so good! When I want to test it and to play along with this connection TM -> FB, I am creating the Proxy-Object, I am filling the required User / Pass / and an ID in order to call the first method. As you have probably guessed already: LOGIN.

ls_in_login-login_request-id = '...some ID...'.

ls_in_login-login_request-user = '...some user ...'.

ls_in_login-login_request-password = '...some password'.

TRY.

CREATE OBJECT lo_proxy

EXPORTING

logical_port_name = 'ZAS_PORT_FB'.

CATCH cx_ai_system_fault INTO lo_ref. " Application Integration: Technischer Fehler

...

ENDTRY.

TRY.

CALL METHOD lo_proxy->login

EXPORTING

input = ls_in_login

IMPORTING

output = ls_out_login.

CATCH cx_ai_system_fault INTO lo_ref. " Application Integration: Technischer Fehler

...

CATCH cx_ai_application_fault INTO lo_ref. " Application Integration: Applikations Fehle

...

ENDTRY.

As a response, (meaning that the connection works and that the WebService acknowledges the connection) I get a "SessionID" -> a string of characters.

In the Wiki of the Service is written that from this point on, every other methods (but I mean ALL of them, logout() also...) need to be called along with this SessionID. The problem is, that this SessionID doesn't have a specific place in the "inbound"-structure of the methods, but this mechanism of passing around the SessionID must be made with URL rewriting. Another solution would be to use COOKIES. From my point of view, a so-called URL rewriting would be easier, right?

In the documentation is the following info written:

"

URL rewriting (recommended):

The JSessionId is attached to the URL of the SOAP request, as follows: http://[URL];jsessionid=[jsessionid]

Caused by tecnical reasons, it is necessary to specify the static string “;jsessionid=” in lower case letters.

"

I have turned this "LO_PROXY" object around and around and around... trying to find a solution... a method...anything that would let me rewrite the URL, but nothing...

I have also tried to use ce CL_HTTP_CLIENT class and to create myself the client and the URL and the host and everything manually... but in this case how do I end up in calling a specific "custom" method -> for instance... how do I call the "LOGIN"... or the LOGOUT...where do I put the parameters, etc?

Do you have any suggestions / ideas / hints ?

Thanks a lot in advance!

Warm regards,

Alex

1_2.jpg (80.0 kB)
2.jpg (92.2 kB)
3.jpg (101.4 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2014 at 07:49 AM

    Hi Stefan,

    You are right! It doesn't support to set URL / HTTP parameters outside the logical port.

    Nevertheless, I have debugged the whole engine and found out that via custom coding (enhancements / modifications) and with extreme attention, the URL can be rewritten as desired.

    When a method of the proxy is called, let's say for instance: lo_proxy->logout (...) - as written up for example, the method CL_HTTP_CLIENT=>CREATE_BY_URL is called dynamically.

    In this method, in the "url" variable is the desired URL that needed to be rewritten.

    Here it's about an importing parameter, so it cannot be changed so easily, but it's not impossible. 😊

    Another place where a nice Enhancement can be created is at the beginning of the FM "SWLWP_URI_PARSE".

    You need to be very careful not to change these places in all cases (this CREATE_BY_URL will be called pretty much), JUST when the specific conditions are fulfilled.

    Have a great day / week! 😊

    Warm regards,

    Alex


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 09, 2014 at 12:17 PM

    Hi Alex,

    the proxy based programming model of the web services infrastructure (ABAP) does not support to set URL parameters or HTTP parameters outside the logical port via coding in a dynamic way.

    Kind regards,

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.