Webservices inside functions

I have a webservice created with just an id and wsdl using
the mx:WebService. Whenever I make a button to call a method from
the web service I can use the bindalbe last result with no problem.
However, when I call the method from within a function, lastResult
is always null. The function, a cfc function, merely returns a
string "test".
//the function below never has anything in lastResult
(looking at debugging and a billion other ways of testing. I've
simplified below
private function test():String {
newService.testCFC();
var myString:String = newService.testCFC.lastResult
return myString;
<mx:WebService id="newService" wsdl="
http://localhost:8500/com/controller/rpController.cfc?wsdl"/>
//This works just fine. testCFC is called when the button is
clicked and the label shows up
<mx:Button label="{newService.testCFC.lastResult}"
click="newService.testCFC()"/>

quote:
Thank you. I seem to understand all that now. I still have
one question regarding the ActionScript. Is it possible to have a
single function that instantiates a webservice, calls a method, and
returns the value from the method?
I was trying to avoid the <mx:webservice>
Well you probably could, but you'd be fighting the way the
language works. It's event driven which is the asynchronous part,
ie., can be executed in any order. "batmitra" has described it well
and I would suggest that you follow that model.
Also you don't need to use <mx:webservice> You can call
it in a method like so:
import mx.rpc.soap.WebService;
var webService:WebService = new WebService( );
webService.wsdl = "
http://localhost:8500/com/controller/rpController.cfc?wsdl";
webService.loadWSDL( );
webService.addEventListener(LoadEvent.LOAD, processWSDL);
which will call the method "processWSDL" when the service is
complete. You can then check for errors and process the results. If
you are convinced you want to do it one function then I guess you
could try to call yourself, but I haven't done that and don't know
how it will work.

Similar Messages

  • How to create webservice from function module

    Hello,
    I'm trying to create webservice from function module from. I choose Utilities/More Utilities/Create Webservice/..From function Module. What data should I enter in section "Enter Package/Request" ?
    When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign namespaces"
    Is there any doc about this procedure (web service creation) with description of all sections ?
    thanks for any reply,
    Lukasz Ferenc

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • Provide Asynchornous Webservice from Function Module

    Hi!
    I need to create a webservice to provide master data. My scenario do not use Process Integration, so I create the webservice from function module (Remote-Enable Module) through SE80.
    When service is created I can see in the configuration tag that is not possible to change to asynchronous mode.
    I want to create asynchronous webservice because I need to return master data. Selecting this data consume a lot of time, so in order to avoid timeouts I think is better to create asynchronous webservice.
    May be I am wrong but I think is not possible to create async webservice without PI.
    All documents I have read until now show async comunication through PI and using proxy clients but I have not found the case I am talking.
    Thanks
    Reagards
    Edited by: jordis on Mar 17, 2011 4:45 PM

    Thanks Raja,
    I think I'm confusing about synchronous / asynchronous concept in webservices. I need an example or an explanation where I can understand it. Taking account that I do not have PI, where scenario I'm moving in?
    I mean, is it possible that an external client calls my webservice created through FM in async mode? Maybe is the client who has to create the corresponding call to the webservice in async mode and I have to do anything.
    Another question related, what does it means the propierty sync/async in a proxy?
    I do not understand your sugestion since I think that proxy creaton is relevant in case of the connecting SAP with an external system (I tried it and I have to inform an URL o WSDL).
    All documents I have readed have been in the context of PI and I think my case is more simply.
    Any more suggestions, links or ideas?
    Thanks
    Regards
    Edited by: jordis on Mar 18, 2011 12:41 PM

  • Consume external WebService inside BW

    Hi,
    does anybody know how to consume an external webservice inside BW ?
    Thanks,
    Max

    You have two options:
    1. Make use of XI.
    2. Use the XML interface in BW.
    refer:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/21d8aa90-0201-0010-5e83-a3798b9a5ee0
    this document shows u to transfer XML data to BW.
    If you are on BI7 then create a RDA XML datasource and integrate your web service to that:
    /people/kamaljeet.kharbanda/blog/2006/11/13/real-time-data-acquisition-bi2004s

  • Error while calling WebService inside ISchedulerTask.

    Hi,
    Env: NW 2004s
      I have a requirement of calling webservice frequently. I developed a portal project with scheduler, where the application gives a runtime error while calling/reading the property file (which is generated during the webservice proxy generation, without it webservice call is impossible).
    I have varified the ear file which contains all the required class files and config files including property file.
    fyi:
    portalapp.xml file looks like this.
    +
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="usermanagement, knowledgemanagement, landscape, htmlb, exportalJCOclient, exportal"/>
      </application-config>
      <components/>
      <services>
        <service name="RFServiceWrapper">
          <service-config>
            <property name="className" value="com.sap.netweaver.rf.wrapper.RFServiceWrapper"/>
            <property name="startup" value="true"/>
          </service-config>
        </service>
      </services>
    </application>
    +
    Any input will be highly appreciated.
    Thanks,
      Vinod

    Following is the error message:
    msg1:
    at <package>.AFFERAAFWSServiceImpl.<init>(AFFERAAFWSServiceImpl.java:10)
    msg2:
    at com.sap.engine.services.webservices.jaxrpc.wsdl2java.ServiceBase.loadProtocolsFromPropertyFile(ServiceBase.java:238)
    Reporting from Logs and Traces.
    Error Located @ following code inside AFFERAAFWSServiceImpl.java, which is a proxy class generated using apache axis
    input = this.getClass().getClassLoader().getResourceAsStream("<package>/protocols.txt");
    loadProtocolsFromPropertyFile(input);
    protocols.txt is another config file generated along with AFFERAAFWSServiceImpl.java, which is been used @ run time.
    FYI: All these files are present on ear file.

  • Modify the content of a table inside function module

    if line_bill-cust_no = line_cust-cust_no.
        line_cust-tot_amt = line_cust-tot_amt + line_bill-bill_amt.
        MODIFY it_cust1 FROM line_cust transporting tot_amt  WHERE  cust_no = line_bill-cust_no.
    inside the function module in se 37 i am getting an error .
    The specified type has no structure and therefore no component called tot_amt....          
    actually if im running this code inside the se38 editor its running fine . but i want to do this inside a function module. when i tried to do this im getting the above error
    kindly help me in resolving the problem.

    hi arunima ,
                       i have declared the tables in the changing tab.. my problem is , how to access the line of the table inside the function module .
    for ex:
    loop at itab into wa where field1 = 'field2'.
    i have declared the wa in the function module but still it gives the error that field1 is not recognisable...
    how to resolve this...
    kindly help me out.

  • Accessing internal table of main program inside function module...

    I have function module say ZFUNC and main program say ZMAIN and internal table defined as IT_TAB inside ZMAIN but not passed as parameter to Function module ZFUNC.
    If I want to access the field value of IT_TAB of  main program ZMAIN inside ZFUNC during debugging then, I simply put <b>(ZMAIN)IT_TAB-amount</b> in ABAP debugger and then change it when the debugger is inside ZFUNC.
    How can I write code to change the value of internal table of main program in function module ZFUNC instead of doing in debugger ? I guess I have to use some field symbols, but not sure. Please suggest.
    Regards,
    Rajesh.

    Yes, you do need to use a field symbol.  Say for example, you had a internal table called IMARC in your program and you want to access it later in a funciton module, you would do something like this.
      data: xmarc type marc.
      field-symbols: <imarc> type marc_upl_tt.
    * Assign an internal table
      field = '(ZPROGRAM_NAME)IMARC[]'.
      assign (field) to <imarc>.
      loop at <imarc> into xmarc.
        write: / xmarc-matnr, xmarc-werks.
      endloop.
    Regards,
    Rich Heilman

  • CALL A WEBSERVICE FROM FUNCTION

    HI to all,
    sorry for my question, but never used webservice since now:
    however would like to know if it's possible to call a web service from a PL/SQL function.
    thanx a lot

    I solved it myself by using utl_dbws package. utl_dbws package is compatible with 10g release2(10.2.0.2) and next higher versions. By using utl_dbws package, it is easy to call a webservice.
    Before i was using utl_http package and a my function was using xml tags heavily. In this case we have to careful in entering xml tags, so that we will return the exact output message.
    Thanks and Regards,
    Mahesh

  • Writing explain plan inside function

    I tried to make a function which will explain plan for supplied SQL statement in the plan table. However I'm getting error in following line
         /* populate the plan */
         EXPLAIN PLAN
         SET STATEMENT_ID = STATEMENT_NAME
         FOR
         SQL_STATEMENT;
    where SQL_STATEMENT is a variable (eg. select * from employee).
    Is it possible to write in this way inside a function/procedure?

    What version of Oracle are we talking about? Some where in 9+ Oracle introduced v$sql_plan and v$sql_plan_statistics which contain the actual plan for SQL that is ran. Depending on exactly the purpose of this procedure is intended to be it may be unnecessary to being with.
    HTH -- Mark D Powell --

  • PreparedStatements with parameters inside functions

    With PreparedStatements, can I use parameters inside of functions. For example, instead of doing:
    stmt = conn.prepareStatement("INSERT INTO MyTable (EncData) VALUES (ENCRYPTBYKEY(KEY_GUID('MyKey'), 'ABCDEF''))");
    I want to do:
    stmt = conn.prepareStatement("INSERT INTO MyTable (EncData) VALUES (ENCRYPTBYKEY(KEY_GUID('MyKey'), ?))");
    stmt.setString(1, "ABCDEF");
    I am getting a 'String or binary data would be truncated' exception when trying this.
    Thanks,
    Kevin

    OK ... let me take you a couple steps back ...
    I can get PreparedStatements to work in Java (J2SE1.5):
    stmt = conn.prepareStatement("INSERT INTO MyTable (Data) VALUES (?)");
    stmt.setString(1, "ABCDEF");
    However, the previous example does not work through SQL Server Management Studio ... it gives a syntax error:
    INSERT INTO MyTable (Data) VALUES (?)
    Moving onto my issue, how do I get PreparedStatement parameters to work within a function:
    stmt = conn.prepareStatement("INSERT INTO MyTable (EncData) VALUES (ENCRYPTBYKEY(KEY_GUID('MyKey'), ?))");
    stmt.setString(1, "ABCDEF");
    And as mentioned earlier, the following works fine in Java J2SE 1.5
    stmt = conn.prepareStatement("INSERT INTO MyTable (EncData) VALUES (ENCRYPTBYKEY(KEY_GUID('MyKey'), 'ABCDEF'))");
    So, in conclusion:
    I can successfully make PreparedStatements perform inserts using parameters in Java
    I can successfully make PreparedStatements perform inserts in Java using the encryption function
    However, I cannot make PreparedStatements perform inserts using parameters in the encryption function in Java
    I cannot get a simple example of PreparedStatements to work in SQL Server Management Studio ... and wouldn't expect to ...
    Thanks,
    Kevin

  • Webservice from function module

    I have created a webservice for a RFC function module.
    but in SICF i cannott test it...it is opening a browser but it is showing page cannot be displayed.
    can anybody tell me the webservice testing procedure..
    Xperts plz...

    [Testing Web Services in the Web Services Navigator|http://help.sap.com/saphelp_nwpi71/helpdata/en/46/7a875063e42d86e10000000a11466f/content.htm]

  • Catch exception inside function arguments

    Class A is a core class in my application. When users create it with bad name format, they get an exception.
    public class A{
        public A(String name) throws FormatException{
            // Check if the name the user entered is valid or not.
    }But during the startup of my application I also create some instances of A. At startup time, any exception caught means that my source code is wrong: a bug on my own!
    In this context I got myself with the following problem, how to catch an exception (that should not happen, because it comes from inside my source code) inside a function call:
        // Create an instance of B that wraps A.
        B b = B( new A("a_name_in_a_good_format") , some_other_parameter); // Possible exception from the constructor of A.Is there any way to catch that, or I'm obliged to create the instance of A before calling any function?
    Edited by: ffrantz on Apr 1, 2010 10:15 AM
    Edited by: ffrantz on Apr 1, 2010 10:17 AM

    Thanks. I guess that is the only solution.
    My problem is that I'm using that in the initialization of an enum, and there's no way to put that construction inside a try/catch block. Code looks like.
    public static enum myReferenceInstancesToClone {
        SIGNAL_MAGNITUDE(new C("mag"), some_other_parameters), // C extends A
        SIGNAL_FREQUENCY(new D("freq"), some_other_parameters), // D extends A
        RESISTIVITY     (new A("R")), some_other_parameters),
        INDUCTANCE      (new A("L") , some_other_parameters),
        CAPACITANCE     (new A("C"), some_other_parameters);
        // FIELDS
        private A _referenceInstance;
        private Object[] _refParameters; // A set of private fields that interest me
        // METHODS
        private OutputPropertiesA property, Object[] some_other_parameters){
         _value = property;
            _refParameters = some_other_parameters
        // Other methods that are convenient to get fields.I'm doing it that way because i'm designing the data model for our application and it is uncertain what is the number and nature of properties that we will need to use. This construction with enums seemed good for me because:
    1) Other designers can add properties in a single line. Without looking around on the rest of the source code.
    2) The initialization process keeps probing the same enumeration, independent on the number/nature of the elements contained in it.
    It is in this context that I cannot catch the exception thrown by the constructor of A:
    public static enum myReferenceInstancesToClone {
        SIGNAL_MAGNITUDE(new C("mag"), some_other_parameters), // Java compiler tells me I have an unhandled exception from 'new C()'
        // ...If there is no way to catch that exception or propagate it.. then I'll do it with static arrays and static initialization blocks... but this means that I'll have to break my 'some_other_parameters' in different arrays.

  • Error while creating webservice from function module in ECC

    Hi
    while creating a web service out of a function module in ECC, in the configure service section we get a message saying ' Remember that the service does not have any runtime configuration and therefore cannot be used. Create the Web service configuration in the NetWeaver Admninistrator (transaction WSADMIN2).'
    instead of check box 'release for runtime'.
    Our ECC at release 7 patch level 22.
    Checked in SCICM, SICF teh service and the folder are active.
    Please suggest if we are missing on anything
    Regards
    Kumar

    In new version on ECC, the runtime configurations needs to be performed in transaction SOAMANGER.
    On executing the transaction, it opens a browser. The important configurations to be performed are:
    1. Configure J2EE server and host. You can choose to provide the ECC server and host
    2. Administration of the service in "Single Service Administration". The navigation path may differ depending of the ECC versions. But it is related to administration of the services.
    Once done, check the WSDL generated.
    Use this WSDL in the NWDS.
    Regards,
    Sharath

  • Select statement inside function with  into keyword

    Hi Everyone,
    i have a function which contains a select statement
    create or replace
    function fun_1(Table_Name1 in varchar2)
    RETURN VARCHAR2
    is
    VAR_GEN_TYPE NUMBER(10);
    TA_U varchar2(256);
    VAR_DATA_FLAG varchar2(1);
    begin
    select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG  from T_DYNAMIC_TABLE T  where T.TABLE_NAME=TABLE_NAME1;
    end
    whene ever i am executing this function giving error message: From Keyword  Not Found
    when i change select statement to
    select T.FLAG ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, VAR_GEN_TYPE from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
    then it is working
    why first statements will not work ?
    i.e.,
    select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
    why in select statement we cannot use into keyword more than one time ?
    Edited by: karteek on Jun 7, 2012 4:23 AM
    Edited by: karteek on Jun 7, 2012 4:24 AM

    select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
    into should be only once..
    the syntax should be
    select <column list>
    into
    <variable list>
    from <table name> where <condition>
    --This query shuold return only one row.
    column list count and variable list count should match
    there should be no comma after last variable.andbefore from.

  • Call an executable program inside function module and pass the table values

    Hi,
           i'm pretty new to HR Abap programming. I have a requirement like "calling an executable program within a function module and the output of the program data(Stored in internal tables) should be passed to the function module tables".
    I've some idea about SUBMIT keyword and i used it in the function module..
    Please do the needful to solve this.
    Regards,
    Selvi.

    Hi,
    Thanks for all your reply.
      I've used Option 3 as per dsouzajovito suggestion. Now i'm getting data in function module tables using import/ export table to memory concept.
    Again a small issue arises, while i'm executing function module it fetches all pernr available in the server and displays the details of last pernr. GET pernr statement is used in the Z report and submit statement is used like this as follows.
      SUBMIT ZHR_RFC_PAYSLIP   WITH  PERNR-PERNR EQ EMPCODE
                                          WITH PYBEGDA EQ FDATE
                                          WITH PYENDDA EQ LDATE
                                          AND RETURN.
    Pls suggest if there is any corrections in the code.
    If i give a pernr as input in the function module, then it should fetch the details related only to that pernr.
    FYI, No selection screen is used here as per requirement.
    Regards,
    Selvi.

Maybe you are looking for