How to consume Web Services form ABAP ?

Hi,
Please advise how to consume web services from ABAP Code ? is there any automatic generating proxy class in order to consume web services ?
I am using NW 7.0 SP15
Thank You and Best Regards
Fernand Lesmana

Hi Fernand,
chk out for this link
Consume an ABAP Webservice (WAS 620) from .Net
Send SMS to India from ABAP
working web service from ABAP
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a4433436-0301-0010-f2a9-9281ad574054
Regards
Sampath

Similar Messages

  • How to consume WEB SERVICES from ABAP ??

    Q: How to consume WEB SERVICES from ABAP program??
         the point here is i am using SAP release 620 and the creation of proxy is out of scenario
         and also no XI.    Its only through ABAP program i need to consume one web service (its a HTTPS one ),
        Using cl_http_client... i tried it but i am totally confused of whats happening ???
    Req some senior ppl advice on the same/approach.
    any hints will suffice my way of approach...!!!
    Please do put in your valuable advices..!!
    Thanks in advance..!!!!

    Hello Srinivas,
    Following is the code for calling web service:
    data: client type ref to if_http_client,
          host   type string value 'server url',
          service type string value '8080',
          path type string value '/sap/public/ping',
          errortext type string,
          proxy_service type string,
          scheme type i value 1.
    call method cl_http_client=>create
    exporting host  = host
            service  = service
         proxy_host  = host
       proxy_service = service
       scheme        = scheme
    importing client  = client
    exceptions
        argument_not_found = 1
        internal_error     = 2
        plugin_not_active  = 3
        others             = 4.
    case sy-subrc.
      when 0.
         write 'Server reached successfully'.
      when others.
         write: 'sy-subrc =', sy-subrc.
    endcase.
    Once you got the client object you can call following methods:
    "Set the requrie URL for the web service you want to call. This is not WSDL anyway!!
    cl_http_utility=>set_request_uri( request = client->request
    uri =' url 2 be called ').
    *Then you can call send method with proper inputs for sending request to WS
    CALL METHOD client->send
    Then you can use receive method for getting the response
    CALL METHOD client->receive
    *You can get last error in case of exceptions
    CALL METHOD cl_http_client=>get_last_error
    *Close the client object
    CALL METHOD client->close
    For more information on full code refer my link in previous replay.
    Thanks,
    Augustin.
    Edited by: Augustarian on Aug 18, 2009 1:49 PM

  • How to consume Web Service in ABAP WebDynpro

    Hi
    I want to know the entire details about how to consume Web Service in WebDynpro application.
    regards
    Piyush

    hI piyush,
    Have a look at this Blog by Thomas Jung.
    /people/thomas.jung/blog/2007/12/17/consuming-services-with-abap
    on consuming webservies thru webdynpro ABAP
    Cheers
    Mary

  • Windows authentification while consuming web service from ABAP

    Hi All,
    We are consuming web service from ABAP, we have created client proxy in SE80 and configured logical port in LPCONFIG.
    This one was working fine. Now we have added  windows user authentification to access this service.
    Now when I'm trying to regenerate this proxy in R/3 it is asking for user and password. When I enter these details this one is not working.
    If I access this service direcly from internet explorer and I enter same user and password then I would able to access this service.
    Could you please let me know how to handle this.
    Regards
    Vikram

    The dialog that is produced by HTTP Destination object of the logical port is designed only for use within Classic Dynpro applications.  There is no prompt produced when running in Web Dynpro.  If possible assign a generic user within the logical port definition and this will be used automatically by all users.

  • Consume web service in ABAP proxy with SOAP header

    Hi Thomas ,
    I am trying to consume web service in  ABAP . I have followed the procedure from one of your web blog <a href="/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap a Developer's Journal Part XIV - Consuming WebServices with ABAP</a> . (640 release).
    I need to pass SOAP header along with SOAP body. As you mentioned I have used if_wsprotocol_ws_header interface to pass header but it is still failing.
    Please see below code and please give some direction to fix the issue.
    1.Create ABAP proxy for WSDL (http://ws.strikeiron.com/SwanandMokashi/StockQuotes?WSDL). It has created structures only for SOAP body.
    2.Create Logical port
    3.Create following program to call proxy
    REPORT  zproxy.
    DATA: ref_stock TYPE REF TO zzco_stock_quotes_soap ,
          ws_header TYPE REF TO if_wsprotocol_ws_header,
          name TYPE string,
          namespace TYPE string.
    TRY.
        CREATE OBJECT ref_stock
      get WS_HEADER protocol
        ws_header ?= ref_stock->get_protocol('IF_WSPROTOCOL_WS_HEADER').
      set somehow header as iXML-DOM tree
        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.
        DATA l_xstring        TYPE xstring.
        DATA l_string         TYPE string.
        FIELD-SYMBOLS <fs_xstring> TYPE xstring.
      Additional Header:
        CONCATENATE
    '<soap:Header>'
    '<s1:LicenseInfo xmlns:s1="http://ws.strikeiron.com">'
    '<s1:RegisteredUser>'
    '<s1:UserID>[email protected]</s1:UserID>'
    '<s1:Password>aaaaaaaa</s1:Password>'
    '</s1:RegisteredUser></s1:LicenseInfo>'
    '</soap:Header>' INTO l_string.
      convert to xstring
        l_xstring = cl_proxy_service=>cstring2xstring( l_string ).
        IF NOT l_string IS INITIAL.
        create iXML DOM document from XML xstring
          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( ).
          add header element by element to SOAP header
            WHILE NOT xml_element IS INITIAL.
              name = xml_element->get_name( ).
              namespace = 'http://swanandmokashi.com' . "xml_element->get_namespace_uri( ).
              IF NOT xml_element IS INITIAL.
              ENDIF.
              ws_header->set_request_header(
                          name = name
                          namespace = namespace
                          dom = xml_element ).
              xml_element ?= xml_element->get_next( ).
            ENDWHILE.
          ENDIF.
        ENDIF.
      CATCH cx_ai_system_fault .
    ENDTRY.
    *Call soap body using abap proxy class.
    DATA: get_quotes TYPE zzget_quotes_soap_out .
    DATA: get_quotes1 TYPE zzget_quotes_soap_in .
    get_quotes1-quote_ticker = 'GE'.
    TRY.
        CALL METHOD ref_stock->get_stock_quotes
          EXPORTING
            get_quotes1 = get_quotes1
          IMPORTING
            get_quotes  = get_quotes.
      CATCH cx_ai_system_fault .
      CATCH cx_ai_application_fault .
    ENDTRY.
    4.It is throwing cx_ai_system_fault error.
    SOAP details:
    Input:
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding" >
    <soap:Header>
    <s1:LicenseInfo xmlns:s1="http://ws.strikeiron.com">
    <s1:RegisteredUser>
    <s1:UserID>[email protected]</s1:UserID>
    <s1:Password>aaaaaaaa</s1:Password>
    </s1:RegisteredUser>
    </s1:LicenseInfo>
    </soap:Header>
    <soap:Body>
    <tns:GetQuotes xmlns:tns="http://swanandmokashi.com">
    <tns:QuoteTicker>GE</tns:QuoteTicker>
    </tns:GetQuotes>
    </soap:Body>
    </soap:Envelope>
    Thanks,
    Kavitha.

    Hi ,
    Thank you for the response. Did you passed user email and password ([email protected] /aaaaaaaa) part of licenseinfo->resisteredUser along with Quoteticker GE in analyzer?
    <a href="http://www.strikeiron.com/Analyzer/OnlineAnalyzer.aspx?WSDL=http://ws.strikeiron.com/SwanandMokashi/StockQuotes?WSDL">ANALYZER</a>
    Thanks,
    Kavitha.

  • Consuming Web Services with ABAP - WSDL

    Hi All,
    I Want to consume web service in abap, i found lot of documents,Here i am having data in the internal table i need to pass
    it to wsdl file, The Web Service or Proxy generates a WSDL file. So this WSDL file can be consumed on ABAP Front and Encrypt the Data that is to be sent to the Banks.
    I found the input and output, Where i can find the method generated or we need to create it
    CALL METHOD io_clientproxy->XXXXXXXXXXXX
    please let me have your valuable ideas
    Thanks in advance,
    Arun.

    Hi Miguel,
    I have not heared about SPROXY, Here i found some code,which calls a web service method and where it is from.
    when i double click on my proxy it shows me some method.IF_PROXY_BASIS_INTERNAL~CREATE_FRAMEWORK
    this is the one web service method. and i meed to pass the internal table data to WSDL file.
    *-- create web service proxy class instance
    TRY.
        CREATE OBJECT io_clientproxy
          EXPORTING
            logical_port_name = 'LP4'.
      CATCH cx_ai_system_fault.
    ENDTRY.
    *-- call web service methods
    TRY.
        CALL METHOD io_clientproxy->get_airport_information_by_is
          EXPORTING
            input  = input
          IMPORTING
            output = output.
      CATCH cx_ai_system_fault.
      CATCH cx_ai_application_fault.
    ENDTRY.
    *-- text processing
    output_string = output-get_airport_information_by_is.
    REPLACE ALL OCCURRENCES OF
        '<' IN output_string WITH '<' .
    REPLACE ALL OCCURRENCES OF
    '>' IN output_string WITH '>' .
    REPLACE ALL OCCURRENCES OF
    'xmlns=' IN output_string WITH 'xmlns:xsl=' .
    *-- parsing
    TRY .
        CALL TRANSFORMATION ('Y_AIRPORT_XML2ABAP')
                SOURCE XML output_string
                RESULT     outtab = outtab.
      CATCH cx_xslt_exception INTO xslt_err.
        DATA: s TYPE string.
        s = xslt_err->get_text( ).
        WRITE: ': ', s.
        STOP.
    ENDTRY .
    Regards,
    Arun.

  • Code for consuming web services in ABAP

    *& Report  ZVM_GET_CITY_TIME
    REPORT  zvm_get_city_time.
    PARAMETERS:
      p_city TYPE zget_city_time_soap_in-city.
    DATA:
      cl_proxy TYPE REF TO zco_time_service_soap,
      input    TYPE zget_city_time_soap_in,
      output   TYPE zget_city_time_soap_out,
      systerr  TYPE REF TO cx_ai_system_fault,
      w_error  TYPE c.
    TRY.
        CREATE OBJECT cl_proxy
          EXPORTING
            logical_port_name = 'ZCO_TIME_SERVICE_SOAP'.
      CATCH cx_ai_system_fault.
        CREATE OBJECT systerr.
        WRITE:/ 'Error in creating object - ', systerr->errortext.
    ENDTRY.
    TRY.
        input-city = p_city.
        CALL METHOD cl_proxy->get_city_time
          EXPORTING
            input  = input
          IMPORTING
            output = output.
      CATCH cx_ai_system_fault.
        CREATE OBJECT systerr.
        WRITE:/ 'Error in calling the method - ', systerr->errortext.
        w_error = 'X'.
    ENDTRY.
    CHECK w_error NE 'X'.
    SKIP.
    WRITE:/ 'The current time in ', p_city, ' is ',
            output-get_city_time_result.

    <i> is there any other way to consume web services in ABAP</i>
    you can use cl_http_client class to make your program to act as http client and post the soap message too webservice. This way you dont need to generate proxy, but you should know the soap message format.
    Regards
    Raja

  • How to consume web service in Agentry in SMP 3.0

    Dear All , I am using web service in Agentry to retrive data but could not able to fetch it . I have made connection with HTTP-XML for consuming webservices. and also give proper information in Agentry.ini files Ex : [HTTPXML-2] name=HTTP-XML Back End authenticationCertificateStore=MY authenticationCertificateStorePassword= authenticationCertificateStorePasswordEncoded=false autoDequote=true ;baseURL=http://localhost:81 baseURL=http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/ basicAuthenticationPassword=123456 basicAuthenticationPasswordEncoded=false basicAuthenticationUserID=P1466405733 constantsFile=httpxml_sd.ini enableAuthentication=false enablePreviousUserAuthentication=false httpConnectTimeout=300 httpReceiveTimeout=300 httpResolveTimeout=300 httpSendTimeout=300 listenOn= timeout=300 timeZoneName= useSSL=false xmlAllowXSLTScript=true xmlNamespaces= xmlResolveExternals=true xmlValidateOnParse=true for more information i have attached agentry XML screen shot as well . Can you please guide me how to consume web services in Agentry correct way ? Note : Currently i am using standard netweaver demo web services . Thanks & Regards ,   Kunal Varaiya
    Tags edited by: Michael Appleby

    The XML Steps URL will be added to the Agentry.ini BaseURL.  So you dont' need the full URL on the step.
    So when Agentry Runs the step to call the backend it will go:
    <BaseURL>/<Step's URL>
    This way if you need to change the base URL, IE, going from Dev to QA to Production Server you only need to change the Base, and not go into every step and update it.
    URL: This attribute contains the URL to which the Agentry Server will make a request. This value will be appended to the value configured as the base URL for the HTTP-XML system connection. This base URL is configured within the HTTP-XML system connection configuration options for the Agentry Server. Proper use of both this base URL option and the URL entered in the requests of the step definitions can support portability for the application, with the base URL being the implementation-specific portion and the step’s URL being the portion not likely to change for the same back end system from one implementation to the next.
    http://help.sap.com/saphelp_smp303sdk/helpdata/en/7c/143d5d70061014b323be16eb0b0a77/frameset.htm 
    Stephen

  • Pros & Cons for consuming web services in ABAP using ABAP PROXY

    Hi,
    Other then performence  is there any other disadvantages like security,etc for consuming web services in ABAP using ABAP proxy?
    I really appreciate if some one provide the more details(Pros & Cons ) regarding cosuming web services and I also want to know is there any other way to consume web services in ABAP.
    Thanks.

    <i> is there any other way to consume web services in ABAP</i>
    you can use cl_http_client class to make your program to act as http client and post the soap message too webservice. This way you dont need to generate proxy, but you should know the soap message format.
    Regards
    Raja

  • Problem at Consume WEB Service in ABAP

    hello!!
    I tell them my problem, is to create a web service from the SE80,  which could be used properly.
    Then there was a change of server, which migrated to the developments and the web service is recreation, but this can not be consumed.
    now I need help, is where do I indicate that the basis so that they can return to consume web services, what services or settings should be activated.
    any suggestion or help are welcome.
    The ECC system is a 5 AS ABAP only.
    from now, I appreciate any help or guidance I can get.

    What is the problem? Are all the services active in SICF for web services and how is the web service being consumed is it through a wsdl file ?

  • Wrong data when consuming web service via ABAP

    Dear all,
    we tried to consume a web service via ABAP and used one of the various existing how-to papers from the internet in order to develop everything.
    The development was not that difficult, but when we now execute our ABAP, we noticed that
    - the first 100 returned rows from the webservice are completely correct
    - then we receive 10-15 completely incorrect rows (empty fields, redundant lines, etc.)
    - the rest of the data (60 records) is correct again
    As we nearly all objects have been generated automatically via SE80, I do not really know where this problem might come from. We double checked the original data and there everything is correct.
    Any ideas?
    Thanks for your feedback,
    Andreas

    Marcelo  Almeida wrote:
    > You can use Logial port for it in LPCONFIG ( Transaction). See this examplo Below:
    >
    > TRY.
    >
    > CREATE OBJECT my_proxy
    > EXPORTING
    > logical_port_name = 'LP01'.
    > CATCH cx_ai_system_fault.
    > ENDTRY.
    >
    > TRY.
    > input-airline_id = p_carrid.
    > input-connection_id = p_connid.
    > input-flight_date = p_fldate.
    >
    > CALL METHOD my_proxy->flight_get_detail
    > EXPORTING
    > input = input
    > IMPORTING
    > output = output.
    > CATCH cx_ai_system_fault.
    > CATCH cx_ai_application_fault.
    > ENTRY.
    >
    > Its necessary create a connection in SM59 (type H) and setting in the call parameters logical port (LPCONFIG).
    Hi,
    thanks for your answer. It´s working!
    Cheers,
    Andy

  • Consuming Web Service from ABAP Web Dynpro

    I have written program to consume KM Web Service through ABAP as well as ABAP Dynpro in SAP R/3 by calling Consumer Proxy.
    When I run the program from SE38, it prompts me for user-id & password. If I pass KM Server user-id and password I am able to execute the web service successfully.
    However, while I execute the same code through Web Dyn-pro , it does not ask for user-id and password & terminates with CX_AI_SYSTEM_FAULT : SOAP:1,007 SRT: Unsupported xstream found: ("HTTP Code 401  : Unauthorized")
    I have created a Logical Port in R/3 & I am using this Logical Port while creating an Object of Consumer Proxy.
    Kindly let me know how to resolve this issue.

    The dialog that is produced by HTTP Destination object of the logical port is designed only for use within Classic Dynpro applications.  There is no prompt produced when running in Web Dynpro.  If possible assign a generic user within the logical port definition and this will be used automatically by all users.

  • Consuming Web Service in ABAP

    Hi,
    We have a Web Service URL on PI. Run time of this Web Service in a Portal Server.
    We need to access the Same URL from ECC using ABAP Programming?
    Can any one tell me how we can call the same Web Service?
    I need to pass few values to the web service using ABAP Code and I need to get back the result into some variables.
    any code available for verify?
    Thanks,
    Sekhar.J

    Hi Sekhar,
    Please see below link. It will be helpful.
    Regards,
    Sudha

  • How to use web service with ABAP Web Dynpro

    Hi.
         do you know, how to web service with ABAP Web Dynpro?

    Hi,
    If you have a webservice ready with you then you can generate a proxy from SE80 and you can use that. You just have to create a port and assign to that generated proxy(CLASS) and you are good to go.
    Let me know if you need more information.
    Thank You,
    Gajendra.

  • To consume web service in ABAP is it required that server should be XI.

    Hi ,
    I am trying to connect to a webservice from netweaver 7.0 systemand it gives an error " Not configured as integration engine". Is it required to have integration engine to consume web service.
    Sanjay

    Hi Sanjay
    You can consume webservices in ABAP but its better to use XI in mid to avoid point to point communication. Using XI you can have a central hub for all services you consume or publish
    Check this link as well
    BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP
    Thanks
    Gaurav

Maybe you are looking for

  • Help with numbering lists in Indesign CS5.5 for epub file

    I am working with a book in Indesign CS5.5 to export it as an epub file. I have been working on formatting the text and I have run into a small problem. Throughout the book there are multiple lists within the texts that need to be numbered. Each list

  • E-mail with Subject, Body and Attachments

    Hi, I am currently completing a project to create an intranet site for employees. We need functionality to send email confirmation of a sale to customers. I'm going to start by saying i have zero web design experience and have only been doing this fo

  • How do I convert a batch of jpegs to one pdf file?

    How do I Convert 70 jpeg images into one pdf file that is not too big to email easily?

  • Sql 2008 r2 property size is not available for database

    Nightly whenever index rebuild process runs My data file and log file gets full and when right click properties on database then I get the error: Property size is not available for database.This property may not exist for this object. What is the err

  • 2.0.1 update forcing library/iPod sync, despite "manual" setting

    I just updated to iTunes 2.0.1, and it is now forcing me to sync my iPod with my iTunes Library - even though I have my iPod set to "Manually manage iPod music & videos." If I try to bypass or cancel out of the sync, I get an error message claiming t