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

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

Similar Messages

  • Error while activating webservice-consumer-proxy

    Hi,
    I'm trying to generate a webservice-consumer-proxy from a Salesforce.com-WSDL-File. When trying to activate the proxy I receive an error-message from class CX_ESD_EXCEPTION stating "Beim Aktivieren des Proxys ist ein Fehler aufgetreten." (in english: "Error occured when activating the proxy"). The WSDL-File is SOAP-Version 1.1, Document/Literal.
    Thank you very much in advance,
    Olli
    [SAP Consulting by mindsquare|http://mindsquare.de]

    I have a similar issue and it says that the reason is one of the exception classes in XML  in not derived from either cx_static_check or cx_dynamic_check.  
    Please let me know if anyone have ideas how to resolve this

  • Error in soap header when use webservice consumer proxy

    Hi all,
    I create a webservice consumer proxy to external server. the webservice provider is .Net  and it required a message level security.
    The soap message should include a soap header, like this:
    <SOAP-ENV:Header>
    <m:AuthHeader xmlns:m="http://tempuri.org/">
    <m:Username>test1</m:Username>
    <m:Password>test</m:Password>
    </m:AuthHeader>
    </SOAP-ENV:Header>
    I have found many information from here. Now I used  IF_WSPROTOCOL_WS_HEADER in my program, like this:
    REPORT  zws_jp_test01.
    DATA: lo_zws_jp_co_service_soap TYPE REF TO zws_jp_co_service_soap .
    DATA: lo_fault TYPE REF TO cx_ai_system_fault.
    DATA: lo_appl_fault TYPE REF TO cx_ai_application_fault.
    TRY.
        CREATE OBJECT lo_zws_jp_co_service_soap
          EXPORTING
            logical_port_name = 'ZWS_JP_LP4'.
      CATCH cx_ai_system_fault INTO lo_fault.
        MESSAGE lo_fault TYPE 'I'.
    ENDTRY.
    DATA: output TYPE zws_jp_create_job_ad_soap_out .
    DATA: input TYPE zws_jp_create_job_ad_soap_in .
    DATA: lr_ws_header TYPE REF TO if_wsprotocol_ws_header.
    DATA: lv_name TYPE string,
          lv_namespace TYPE string.
    DATA l_xstring TYPE xstring.
    DATA l_string TYPE string.
    DATA: ixml TYPE REF TO if_ixml,
         xml_document TYPE REF TO if_ixml_document,
         xml_root TYPE REF TO if_ixml_element,
         xml_element TYPE REF TO if_ixml_element,
         xml_node TYPE REF TO if_ixml_node.
    lr_ws_header ?= lo_zws_jp_co_service_soap->get_protocol(
                                               if_wsprotocol=>ws_header ).
    CONCATENATE
      '<SOAP-ENV:Header>'
        '<m:AuthHeader xmlns:m="http://tempuri.org/">'
          '<m:Username>test1</m:Username>'
          '<m:Password>test</m:Password>'
        '</m:AuthHeader>'
      '</SOAP-ENV:Header>'
    INTO l_string.
    l_xstring = cl_proxy_service=>cstring2xstring( l_string ).
    CALL FUNCTION 'SDIXML_XML_TO_DOM'
      EXPORTING
        xml           = l_xstring
      IMPORTING
        document      = xml_document
      EXCEPTIONS
        invalid_input = 1
        OTHERS        = 2.
    IF sy-subrc = 0 AND NOT xml_document IS INITIAL.
      xml_root = xml_document->get_root_element( ).
      xml_element ?= xml_root->get_first_child( ).
      WHILE NOT xml_element IS INITIAL.
        lv_name = xml_element->get_name( ).
        lv_namespace = xml_element->get_namespace_uri( ).
        lr_ws_header->set_request_header(
            name            = lv_name
            namespace       = lv_namespace
            dom             = xml_element
            must_understand = SPACE
        xml_element ?= xml_element->get_next( ).
      ENDWHILE.
    ENDIF.
    input-job_ad-id = 0.
    input-job_ad_text-id = 0.
    input-job_ad-publish_location = 1.
    TRY.
        CALL METHOD lo_zws_jp_co_service_soap->create_job_ad
          EXPORTING
            input  = input
          IMPORTING
            output = output.
      CATCH cx_ai_system_fault INTO lo_fault .
        MESSAGE lo_fault TYPE 'I'.
      CATCH cx_ai_application_fault INTO lo_appl_fault.
        MESSAGE lo_appl_fault TYPE 'I'.
        WRITE: output-create_job_ad_result-id.
    ENDTRY.
    But there is error when I run this program. the error is "SoapFaultCode:1"
    In tcode ST11, I see this log:
    E SOAP_RUNTIME 20100624004837.9280000 : CL_SOAP_RUNTIME_CLIENT
    ->EXEC_PROCESSING SOAP Fault Exception caught: : SOAP header To
    was not understood.
    btw the release is  701.
    Any one can navigate me to solved the problem?

    Hi,
      I have the same problem as you did before and I posted my code in this [thread|Change SOAP Header: Consuming Webservice;.
      In order to to solve your problem, I need to know what is the header that you want to add into the header, what is WSDL, and have you try testing that web service using other tool such as SOAPUI or XMLSPY and what is the result of testing tool?
    Regards,
    Chaiphon

  • How to Assign Logical port for a standar Consumer proxy

    Hello,
    I'm working with a SAP application creating a WS Connector that ask me for the following data:
    - Class name:
    - Logical Port name:
    As far as I have read SAP delivers for this application an example implementation for the following web service: ProductionBillOfMaterialVariantBasicDataByMaterialAndPlantQueryResponse_In with the /BCV/CL_SIN_WS_BOM class.
    And the help also says that We can find the example implementation delivered by SAP for the Web service ProductionBillOfMaterialVariantBasicDataByMaterialAndPlantQueryResponse_In in the package /BCV/SIN_PRX, under Service Consumer /BCV/CO_PRODUCTION_BILL_OF_MAT
    In se80 transaction under /BCV/SIN_PRX package I can find /BCV/CO_PRODUCTION_BILL_OF_MATERIAL consumer proxy.
    As far as I know, I just need to assign a Logical port to this proxy.
    So, I go to soamanager transaction under "Service-Administration" --> "Single Service Configuration" and find this Consumer proxy. Then, under Configuration tab I select "Create logical port" option but I need to fill an URL for WSDL access.
    Where can I find this URL? I think that I need to provide de WSDL URL (end point) of the ProductionBillOfMaterialVariantBasicDataByMaterialAndPlantQueryResponse_In Web Service but I can't find it on the soa manager. Or maybe I need to implement a WS by my own WB using the /BCV/CL_SIN_WS_BOM class?
    I appreciate if someone could help me with these SOA concepts.
    Thanks in advance,
    Abigail.

    Hi Abigal,
    In  SOAMANAGER , u can configure the logical port in 3 ways first it by WSDL and second by manually and third by PI.
    1. WSDL based :   URL will automatically determined using WSDL file.
    2. MANUAlly :   in this , we have to provide the URL .
    Thanks
    jitendra

  • APEX: Internet domain mapping / URL rewrite for Apps in the cloud

    Hello,
    I have registered for a trial access since first day in which the cloud was launched ... But, did not get access till now ... If I were to buy it, am I going to get access right away ??
    Is Oracle Cloud going to offer Internet domain name mapping to a specific APEX application ???
    Is Oracle Cloud u going to offer URL rewrite where APEX URL is not Search Engine friendly.... e.g:
    This site: http://www.enkitec.com/ was built on APEX, but as you can see the URL was rewritten ????
    Best Regards,
    Fateh

    Hi,
    According to your post, my understanding is that the rule was not processing for SharePoint 2013 result page.
    Please make sure you add the reverse rewriting rule correctly.
    For more information, you can refer to:
    Add the reverse rewriting rules (in the HTML)
    Setting up a Reverse Proxy using IIS, URL Rewrite and ARR
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Always use URL Rewriting for session tracking?

    All you JSP guru:
    I am working on a JSP project that requires session tracking. I have successfully implements session tracking with both cookies or URL rewriting. I know that with the HttpSession object, it will always try to use cookie first, if that's disabled, then it'll automatically switch to URL rewriting. However, is there a way to force the HttpSession object to ALWAYS use URL rewriting instead of cookies? I have searched for an answer for a long time and haven't been able to found a solution. Is it possible at all? Thank you very much.

    i was going to say that WebSphere always uses URL rewriting if you enable it at all, but someone beat me to it (indirectly) :-)
    however, that seemed to me to be a violation of the spec, which seemed to imply the behaviour you're describing (only use URL rewriting if cookies are not supported on the current client)
    here's a response someone else made on a websphere newsgroup to a statement in that regard:
    I believe you are technically correct. However from my
    experience, I think the spec if flawed in this area since
    there is no reliable way of determining whether the
    client browser supports cookies. The authority on
    cookies (www.cookiecentral.com) says:
    "To properly detect if a cookie is being accepted via
    the server, the cookie needs to be set on one HTTP
    request and read back in another. This cannot be
    accomplished within 1 request."
    This is asking too much of a servlet engine
    implementation. Even if it did submit a request for this
    purpose, the user could refuse the cookie. So
    then technically the browser supports cookies, but the
    servlet engine infers it doesn't. So if the servlet engine
    infers the browser does not support cookies and so
    encodes the URL, it is again out of spec because the
    browser really does support cookies. By doing it
    however encoding is configured makes things simpler,
    robust, consistent and avoids the flaw.
    My opinion.so, mostly i'm just rambling, but if you're using websphere, you should get the behaviour your boss wants. if you're using something else, i suppose there's a chance it'll "violate" the spec in this same, potentially helpful way.
    btw, i remember somebody else complaining that URL rewriting is less secure than cookies, but i kinda think they're about equal. it seems like either could be intercepted by a sniffer and then used to spoof. but i'm no expert in that stuff...

  • Apache Url rewrite for portal URLs

    Hi,
    I have a requirement where i need to write simple URL's for the default portal uRL's
    for example
    inspite of using default url like "http://myserver:port/portal/server.pt/community/abc_xyz/123/efg_jkl/12345",
    if user uses
    "http://myserver:port/portal/server.pt/xyz"
    It should navigate to same default URL.
    Can somebody let me know how this can be achieved.
    I know Url rewriting is done through Apache Url rewrites but do not have an idea how apache does it with portal Url's. What configurations need to be done in order to manage portal Url's with apache rewrites.
    Thanks
    Ajay

    Hi Ryan,
    Thanks for the reply. The link shows how to write the Rewrite rules in apache. I am familier with that. The actual problem is that how can the portal Url's be controlled by apache rewrites. My apache and weblogic are both on the same server instance but after writing the rewrite in httpd.conf file. It does not work out. Just want to know how can i tell apache to handle my portal Url's too.
    Is there any specific entry that we need to make for doing this.
    Thanks
    Ajay

  • Using URL Rewrite for HNSC Web App

    Greetz!
    I'm using host named site collections in my deployment of 2013 Enterprise. I've got a single web app, on the default zone, that was created on port 443 with the -SecureSocketLayer parameter. How can I seamlessly redirect users accessing a HNSC with http
    to the correct (and only) https url? I'm using the URL Rewrite 2.0 with IIS 8.5.
    I have the following rule in place but it is still throwing a 404 on pages. Is this able to work with Host Named Site Collections and does it matter that I've installed the Web App on 443 without having it on 80 first? It shouldn't but SharePoint has
    surprised me before ;):
      <rule name="SSL Redirect" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://{SERVER_NAME}" redirectType="Found" />
                </rule>
            <rule name="HTTP/S to HTTPS Redirect" enabled="false" stopProcessing="true">
              <match url="(.*)" negate="true" />
                <conditions logicalGrouping="MatchAny">
                        <add input="{SERVER_PORT_SECURE}" pattern="1" />
                        <add input="{SERVER_PORT_SECURE}" pattern="0" />
         </conditions>
         <action type="Redirect" url="https://{HTTP_HOST}" redirectType="Permanent" />
         </rule>
    Love them all...regardless. - Buddha

    are you using the URL Rewrite on the same IIS web application as the SharePoint sites?
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Unclear on URL rewriting for SunONE

    On IAS 6.5 running on IWS 6.0 SP4, when is a URL actually rewritten with the Session ID?
    1. When I call response.encodeURL(theURL) so that its return value should be theURL with the extra Session ID params.
    2. When the html is sent back and the AppServer or WebServer intercepts the html and rewrites all URLs regardless of whether I called response.encodeURL(someURL).
    I ask cause it doesn't seem like response.encodeURL is doing anything. Although other URLs that I didn't explicitly encode are getting encoded.
    I have found that the URLs that are not rewritten with the Session ID are those that appear in:
    1.Javascript such as onClick="javascript:document.location.href='/NASApp/myscriptservlet' "
    2. Posted Forms such as <form method="post" action="/NASApp/myapp/myformservlet">
    And URLs that are rewritten with the Session ID are those that appear in:
    1. Anchor Tags such as link
    2. Image Tags such as <img src="/NASApp/myapp/myimageservlet">
    The worst part of it all is that in my JSP I explicitly call encodeURL for the URL in the javascript and the form action URL and these are the two that don't get encoded.

    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

  • URL rewriting for the links

    Hi
    I have my webapplication which is running on tomcat ....and as of now i havent encoded any of my links in the web application ...they are like
    <a href="/action.do?id=1"></a>
    Is it my duty to keep all the URLs encoded so that if the client diables the browser this would be helpful ??
    Currently then if a client disables the cookies my application should not work properly right ??
    Can any one enlighten this

    If you are using Struts, then use the html:link tag.
    That will automatically encode the URLs for you if necessary.
    <% pageContext.setAttribute("id", "1"); %>
    <html:link action="/action" paramId="id" name="id"/>
    http://struts.apache.org/userGuide/struts-html.html#linkCheers,
    evnafets

  • Webservice Consume Proxy error : XML stream: 'document not wellformed'.

    Dear All ,
      I facing problem when i try to test my service consumer .
      Its end with error message :
      Error when processing Web service call
      Error when calling SOAP Runtime functions: CX_SXML_PARSE_ERROR:An exception with the type CX_SXML_PARSE_ERROR  occurred, but was
      An exception with the type CX_SXML_PARSE_ERROR occurred, but was neither handled locally, nor declared in a RAISING clause
      Error while parsing an XML stream: 'document not wellformed'.
      Need your help guys.
    Thanks,
    Ikrar
    Edited by: ikrarSAP on Jun 17, 2011 2:34 PM

    Hi,
                                    Actually i dont have any idea on BOBJ. But this kind error usually occurs in the following cases:
    The parameters you called from web service do not match with parameters using by tables at R/3. So, it can not parse.
    A Web service's WSDL file is not well-formed because of an element specifying two attributes with the same name, the client application produces this error.
    Either there is indeed an issue with how the XML is being encoded and then decoded on other end or there's a step that is being missed somewhere.
    Thanks & Regards,
    Sai Kiran Rao.

  • Supress URL rewriting through gateway for specific URL's ??

    I want to know how to supress URL rewriting for some spcific URL's. Currently the property "Rewrite All URL's" is set to true in the gateway profile.
    Default ruleset is applied on to the rewriter during installation. Do I need to write a ruleset to achieve this ?? If yes, how to approach onto developing this ruleset.
    Please help.
    Thanks.

    I don't think what you ask is possible, but the reverse is.
    Do not select Rewrite All URL's. In my knowledge it really is all and no exceptions possible. BTW The ruleset define what's inside HMTL etc., not which links are to be rewritten.
    Solution:
    In Admin console:
    Service Management -> Gateway-> <your gateway profile> ->Proxies for Domains and Subdomains
    Fill this with the domains you want rewritten. All other domains are not rewritten.
    Lemme know if this helps.
    This site (and the Sun One Portal) needs feedback!
    Ronald

  • URL Rewriting in JSP/Servlets

    Enabling URL rewriting for session support where cookies are switched off, results in the URL being rewritten as myURL/$SessionID$a_very_long_string.
    I believe that the /$SessionID$ is configurable on the server, does anyone know how ?
    OAS version 4.0.8.1. patched with JSP support.

    Why is it placing a ';' before jsessionid ? Shouldn't
    it be a '&'? The current result is a page not found.Your url looks ok to me. '&' seperates parameters. I'm using the Struts framework to handle those ugly details and it generates urls like this one for me:
    http://localhost:8080/JspMini/main.jsp;jsessionid=C2C1C2D9C6106758047127038554C813
    Looks like you have another problem...
    HTH, Markus

  • WCF Url Rewriting using global.asax

    Hello,
    I am doing Url Rewriting using global.asax but getting below error message. 
    Description: HTTP
    404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 
    Requested URL: /Services/MyService.svc/rest/CheckInternet
    I tested service. its working fine without url rewriting. 
    please help me to solve this issue. 
    Please "Mark as Answer" if this post answered your question. :)
    Kalpesh Chhatrala | Software Developer | Rajkot | India
    Kalpesh 's Blog
    VFP Form to C#, Vb.Net Conversion Utility

    Hi Kalpesh Chhatrala,
    I wonder if you are using the WCF Soap Service or the WCF Rest Service.
    Since your WCF Service works very well without the URI Rewriting, then it seems that you have do something wrong during the process of the URI Rewriting, so please try to refer to the following articles about how to do the URI Rewriting
    for the WCF Service:
    http://blogashwani.blogspot.com/2013/02/url-rewriting-for-wcf-service.html .
    http://blogs.msmvps.com/abu/2008/12/22/url-rewriting/ .
    http://blogs.msdn.com/b/endpoint/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • If user disable cookie how to set and use session with URL Rewritting

    if user disable cookie how to set and use session with URL Rewritting by append session ID in url

    If cookies are disabled, then app server will automatically try to use URL rewriting for session control. Programmer's responsibility is to encode any links or redirects using
    response.encodeURL("/yourPage.jsp")
    and
    response.encodeRedirectURL("/yourPage.jsp")
    See API for details
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String))

Maybe you are looking for

  • Can't print .indd booklet to PDF; opens print utility instead of Acrobat

    Thanks in advance for any help you can lend. I have a 16 page .indd document that I'm trying to export via "print booklet", using Adobe PDF 9.0 as my printer. Every time I try to print as a PDF, it goes through the process of compiling the images, lo

  • Report output format xml, missing column while open in excel for single row

    Dear, There is a strange case, we have an customize concurrent program to display output in xml format. Now Problem is, if query get single record on the bases of parameter then there is no column heading available in excel. However, if parameter mee

  • Did my iMac automatically update to "n"?

    Just got a new AEXn and loaded the new AE utility on my imac (24" intel), got the AEXn up and running. Curious - how do i tell if my iMac is now "n" enabled? (I'm running the network as n/g because i have to hook up older laptops from time to time.)

  • Makes a hash converting to .doc or .rtf

    what's the point in exporting to .doc or .rtf if there is no fidelity to buzzword original?

  • Netflix not playing after adobe update

    I just updated adobe and as soon as I did my Netflix stopped playing. It keeps coming up saying the destination is unavailable. I have just updated silverlight and all Plug in's are accepted etc so no problems there. Can someone please help me. So fr