Passing a bean as a SOAP parameter

hi
I am experimenting with the SOAP example in
examples.webservices.message provided
with WLS 6.1 Beta1.
I have changed to parameter to be a (valid) JavaBean
ProducerClient seems to be starting to send it ok
Do I assume that the error (shown below) is actually
a Class Not Found error because the bean class is not
known to WLS.
(I wasnt certain whether the intermediate 'transport layers'
needed to know anything about the class)
If so should such classes be placed in the 'lib' directory
of the WebService application? (and if this is the case
how to I tell the Ant WSGEN task to do this?)
I realize that codec/type mapping may also be involved
but no docs (only have PDFs)
thanks
Jim Nicolson
Client Side exception:
-------------- SENDING XML --------------
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<SOAP-ENV:Body>
<ns0:send xmlns:ns0='urn:MsgSend'
SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<ns0:message xsi:type='bean:SOAPParameterBean'
xmlns:bean='java:com.nicolson.ejp.examples.webservices.wls61.message'>
<stringField xsi:type='xsd:string'>HelloWorld</stringField>
<intField xsi:type='xsd:int'>47</intField>
<booleanField xsi:type='xsd:boolean'>false</booleanField>
</ns0:message>
</ns0:send>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
java.io.FileNotFoundException: http://localhost:7001/msg/sendMsg
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:545)
at
sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnect
ion.java:810)
at weblogic.soap.WebServiceProxy.getSessionCookie(WebServiceProxy.java:463)
at weblogic.soap.WebServiceProxy.receive(WebServiceProxy.java:431)
at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:400)
at weblogic.soap.SoapMethod.invoke(SoapMethod.java:178)
at
com.nicolson.ejp.examples.webservices.wls61.message.SProducerClient.main(SPr
oducerClient.java:43)
Exception in thread "main"
WLS Console Exception:
<19/07/2001 23:15:16> <Error> <HTTP>
<[WebAppServletContext(3059366,web-services
,/web-services)] Root cause of ServletException
org.xml.sax.SAXException: Could not find a codec that understood how to
decode [
weblogicx.xml.stream.StartElementEvent: ns1:message (urn:MsgSend)]
[uri->http://www.w3.org/1999/XMLSchema-instance ln->type
qn->xsi:type val->bean:SOAPParameterBean]
[uri-> ln->bean qn->xmlns:bean
val->java:com.nicolson.ejp.examples.webservices.wls61.message] using
http://schemas.xmlsoap.org/soap/encoding/: [ CodecFactory:
http://xml.apache.org/xml-soap/literalxml=null,
http://schemas.xmlsoap.org/soap/encoding/=null, =null]
at weblogic.soap.codec.CodecFactory.decode(CodecFactory.java:49)
at
weblogic.soap.codec.SoapMessage.readOperation(SoapMessage.java:209)
at weblogic.soap.codec.SoapMessage.read(SoapMessage.java:127)
at
weblogic.soap.server.servlet.DestinationSendAdapter.doPost(DestinationSendAd
apter.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:245)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2279)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1923)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>

wsgen ant task can not add files to web-inf\classes directory.
Jim Nicolson wrote:
hi manoj
thanks...
oops on the set methods - I was treating it as an immutable value object
(which makes no sense in this context!)
I have the classes config/examples/client classes directory - I actually
wouldn't want to put
them in the server directory so the web-inf\classes dir is the best
place
Is there a way of geetting the ANT task to do this or do I have to do it
after the build?
I'm struggling a bit with the descriptions of the various ANT task
attributes in the pdf doco.
thanks
Jim
"manoj cheenath" <[email protected]> wrote in message
news:[email protected]...
Two things:
1. make sure that SOAPParameterBean is available at the server side.
either in the server classpath or in the web-inf\classes dir of the
web-services.war
2. setXXX methods in SOAPParameterBean are protected. It should
be public.
HTHs
-manoj
Jim Nicolson wrote:
hi
Just double checked the pdf doco (its a very simple bean) and
fields of type String, int, boolean are all supported types
The WLS message example (and my adaptation) uses dynamic
service invocation and I'm using the ant build scripts as is.
I do have the client.jar in my project path.
Since it is a message based web service, the client just delivers
an arbitrary object to a queue/topic destination via the web
service.
I also changed the int, and boolean fields to Integer and Boolean
but this made no difference.
Attached is WSDL, client and bean.
My eval expires tomorrow so I'll continue this after GA is released
good luck
Jim Nicolson
"CleGro" <[email protected]> wrote in message
news:[email protected]...
Hi - actually I'm working on a similar problem:
1) Are you sure, the bean's properties are of the supported data typeslisted
here ?
http://edocs.bea.com/wls/docs61/webServices/develop.html#1038901
2) Could you send me the generated WSDL document (to compare) please ?
Cle
"Jim Nicolson" <[email protected]> wrote:
hi
I am experimenting with the SOAP example in
examples.webservices.message provided
with WLS 6.1 Beta1.
I have changed to parameter to be a (valid) JavaBean
ProducerClient seems to be starting to send it ok
Do I assume that the error (shown below) is actually
a Class Not Found error because the bean class is not
known to WLS.
(I wasnt certain whether the intermediate 'transport layers'
needed to know anything about the class)
If so should such classes be placed in the 'lib' directory
of the WebService application? (and if this is the case
how to I tell the Ant WSGEN task to do this?)
I realize that codec/type mapping may also be involved
but no docs (only have PDFs)
thanks
Jim Nicolson
Client Side exception:
-------------- SENDING XML --------------
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<SOAP-ENV:Body>
<ns0:send xmlns:ns0='urn:MsgSend'
SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<ns0:message xsi:type='bean:SOAPParameterBean'
xmlns:bean='java:com.nicolson.ejp.examples.webservices.wls61.message'>
<stringField xsi:type='xsd:string'>HelloWorld</stringField>
<intField xsi:type='xsd:int'>47</intField>
<booleanField xsi:type='xsd:boolean'>false</booleanField>
</ns0:message>
</ns0:send>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
java.io.FileNotFoundException: http://localhost:7001/msg/sendMsg
atsun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnectio
n
..java:545)
at
sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnec
t
ion.java:810)
atweblogic.soap.WebServiceProxy.getSessionCookie(WebServiceProxy.java:463)
at weblogic.soap.WebServiceProxy.receive(WebServiceProxy.java:431)
at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:400)
at weblogic.soap.SoapMethod.invoke(SoapMethod.java:178)
at
com.nicolson.ejp.examples.webservices.wls61.message.SProducerClient.main(SP
r
oducerClient.java:43)
Exception in thread "main"
WLS Console Exception:
<19/07/2001 23:15:16> <Error> <HTTP>
<[WebAppServletContext(3059366,web-services
,/web-services)] Root cause of ServletException
org.xml.sax.SAXException: Could not find a codec that understood how
to
decode [
weblogicx.xml.stream.StartElementEvent: ns1:message (urn:MsgSend)]
[uri->http://www.w3.org/1999/XMLSchema-instance ln->type
qn->xsi:type val->bean:SOAPParameterBean]
[uri-> ln->bean qn->xmlns:bean
val->java:com.nicolson.ejp.examples.webservices.wls61.message] using
http://schemas.xmlsoap.org/soap/encoding/: [ CodecFactory:
http://xml.apache.org/xml-soap/literalxml=null,
http://schemas.xmlsoap.org/soap/encoding/=null, =null]
at
weblogic.soap.codec.CodecFactory.decode(CodecFactory.java:49)
at
weblogic.soap.codec.SoapMessage.readOperation(SoapMessage.java:209)
at weblogic.soap.codec.SoapMessage.read(SoapMessage.java:127)
atweblogic.soap.server.servlet.DestinationSendAdapter.doPost(DestinationSendA
d
apter.java:109)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:853)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
a
:245)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
a
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletC
o
ntext.java:2279)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.jav
a
:1923)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
Name: SProducerClient.java
SProducerClient.java Type: java/*
Encoding: x-uuencode
Name: SOAPParameterBean.java
SOAPParameterBean.java Type: java/*
Encoding: x-uuencode
Name:examples.soap.msgService.MsgSend.wsdl
examples.soap.msgService.MsgSend.wsdl Type: unspecified type(application/octet-stream)
Encoding: x-uuencode

Similar Messages

  • Pass Bean Name as a parameter?

    Hi,
    Is it possible to pass the bean name as a parameter to the method? In that case, we can pass the bean name as a String to the calling method?
    Thanks
    Aishu

    You can use f:param, f:attribute or f:setPropertyActionListener to pass "parameters" to the method.
    Also see [http://balusc.blogspot.com/2006/06/communication-in-jsf.html].

  • Passing a bean as a parameter

    I wrote someting like this:
    <h:form>
            <h:inputText value="#{myBean.text}"/>
            <h:commandButton value="Send" action="#{managerBean.handleMyBean}"/>
    </h:form>Now the "managerBean" needs the whole "myBean" for adding it to a Vector. How can I accomplish this? I think the best would be passing the whole object as a parameter or something similar.

    Just access it in the desired scope or inject it as managed property in faces-config.
    Also see http://balusc.blogspot.com/2006/06/communication-in-jsf.html for some pointers.

  • How to pass XML tags in a soapbody parameter having datatype as string?

    Hi,
    I need to pass XML tags as a String parameter in SOAP:Body.
    When I tried send SOAP Request, The SOAP Request was changing < to <
    and > to > respectively. Is there any way to ensure that the XML tags (< and >) remain as it is without getting changed.
    I also tried to retrieve XML file and stored in a StringBuffer and tried to send SOAP Request but i am still receiving the < and > tags in my SOAP Request.
    Pl suggest some alternatives to avoid storing the XML in the form of string and instead directly store the XML into a XML Node so that i can avoid the above condition
    Thanks in advance,
    gnsinhyd

    Hi,
    The sample code I used is as follows:
    package somepackage;
    import javax.mail.internet
    import javax.xml.messaging.*;
    import javax.xml.soap.*;
    import javax.xml.transform.*;
    import javax.activation.*;
    public class SomeClassName{
    // Some namespace declarations
    public static void main(String[] args) throws someExceptions{
    try
    // Create the connection
    SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection connection = connectionFactory.createConnection();
    // create a new SOAP message using SAAJ API�s
    MessageFactory messageFactory = MessageFactory.newInstance();
    SOAPMessage request = messageFactory.createMessage();
    // Create a SoapAction header
    MimeHeaders headers = request.getMimeHeaders();
    headers.addHeader("SOAPAction", "soapaction url");
    // Object for SOAP Message parts
    SOAPPart part = request.getSOAPPart();
    SOAPEnvelope envelope = part.getEnvelope();
    envelope.addNamespaceDeclaration("xsd","http://www.w3.org/2001/XMLSchema");
    envelope.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
    //envelope.addNamespaceDeclaration("enc","http://schemas.xmlsoap.org/soap/encoding/");
    envelope.addNamespaceDeclaration("soap","http://schemas.xmlsoap.org/soap/envelop/");
    //envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
    SOAPBody body = envelope.getBody();
    SOAPHeader header = envelope.getHeader();
    // Now, build the ClaimStorage element in the body for our request
    Name somename = envelope.createName("somename");
    // � and configure it with the specifics of our request
    SOAPElement ClaimStorage = body.addTextNode("somename");
    ClaimStorage.addNamespaceDeclaration("xmlns","url");
    ClaimStorage.addChildElement(somename).addTextNode("somename");
    ClaimStorage.addChildElement(xmlclaim).addTextNode("<XMLTAGS">); <---THE PROBLEM IS HERE
    ----> THE XML TAGS < > ARE CHANGING TO &LT; AND &GT; MOST PROBABLY DUE TO POST I THINK.
    // Save Message
    request.saveChanges();
    // View SOAP Request
    System.out.println("\n Soap Request:\n");
    request.writeTo(System.out);
    System.out.println();
    // Now, create a connection to the HTTP SOAP endpoint
    URLEndpoint endpoint = new URLEndpoint("url.asmx");
    // Send request, view response. In a real program, we�d process the response envelope programmatically to see if there was a fault, etc.
    System.out.println("request =\n" + request);
    SOAPMessage response = connection.call(request, endpoint);
    // View the output
    System.out.println("\nXML Response\n");
    // Create Transformer
    TransformerFactory tff = TransformerFactory.newInstance();
    Transformer tf = tff.newTransformer();
    // Get reply content
    Source sc = response.getSOAPPart().getContent();
    System.out.println("SOAP Body" + response.getSOAPBody());
    // Set output transformation
    StreamResult result = new StreamResult(System.out);
    tf.transform(sc, result);
    System.out.println();
    // Close connection
    connection.close();
    System.out.println("\nResponse =\n" + response);
    catch (Exception e)
    e.printStackTrace();
    Pl. reply as soon as possible
    Thanks in advance

  • How can I pass an empty array to a parameter of type PLSQLAssociativeArray

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

  • Passing ALL values to a single parameter

    In Bi Publisher Report, I need to pass 'ALL' values to a single parameter
    Here is brief explanation about my requirement,
    I have 3 parameters
    Parameter A,
    Parameter B,
    Parameter C
    I have to pass ALL values to last parameter i.e; Parameter C and the rest should pass only single value, how should I do that?
    Any help would be greatly appreciated.
    Thank you

    Hi,
    have a look here: http://www.oracle.com/global/de/community/bip/tipps/dynamische_queries/index_en.html
    This might give you an idea how to work with multi-value parameters.
    Regards
    Rainer

  • Passing a Vector object as a parameter to a method

    Hi,
    How can I pass a Vector object as a parameter to a method?
      void buttonAdd_actionPerformed(ActionEvent e) {
        Vector studentHobbies = new Vector();
          String[] items = listHobbies.getSelectedItems();
          for (int i=0; i<items.length; i++) {
            studentHobbies.addElement(items);
    newStudent = new Student(Name,StudentNumber,studentHobbies);
    studentenlist.addTo(newStudent);
    So I want to pass the Vector object 'studentHobbies'  to a method.
    Would I do something like this :import java.util.Vector;
    public Student(String Name, int StudentenNumber, Vector studentHobbies){
    this.Name = Name;
    this.StudentNumber = StudentNumber;
    this.studentHobbies = StudentenHobbies;

    yes, thats how you do it.
    maybe you should first try your idea and then ask people questions?
    also, use ArrayList instead of Vector, its better - google as to why if you care.

  • Pass a ViewObject as a data parameter into Oracle Reports

    Can I pass a ViewObject as a data parameter in an Oracle Reports jsp Report?

    you can use impliment this script to your query get data from file
    function AfterPForm return boolean is
    infile text_io.file_type;
    linebuf varchar2(3000) := '';
    filename varchar2(100);
    v_employee_id varchar2(2000);
    begin
    filename := :P_file_name; /* you can pass the file name like this c:\temp\test.txt */
    infile := text_io.fopen(filename,'r');
    loop
    text_io.get_line(infile,linebuf);
    v_employee_id := v_employee_id&#0124; &#0124;linebuf&#0124; &#0124;' ';
    end loop;
    if text_io.is_open(infile) then
    text_io.fclose(infile);
    end if;
    exception when no_data_found then
    text_io.fclose(infile);
    v_employee_id := replace(rtrim(v_employee_id),' ',',');
    :p_employee_param := 'and employee_id in ('&#0124; &#0124;v_employee_id&#0124; &#0124;')';
    /* you can use either 'where employee_id in ('&#0124; &#0124;v_employee_id&#0124; &#0124;')' or
    'and employee_id in ('&#0124; &#0124;v_employee_id&#0124; &#0124;')' */
    return (TRUE);
    end;
    I think it will help you to solve your problem. Do not forget to put &v_employee_param
    Good Luck
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by gvardhan:
    The file will have one EmployeeID per line as follows
    100
    200
    ...<HR></BLOCKQUOTE>
    null

  • Pass multiple values as single input parameter into pipelined function

    Hi all,
    My need is to pass multiple values as single input parameter into pipelined function.
    For example - "2" and "3" are values of input parameter "t":
    with data as (
    select 1 as t from dual union all
    select 2 as t from dual union all
    select 3 as t from dual union all
    select 4 as t from dual union all
    select 5 as t from dual
    select * from data where t in (2,3)Is it possible at all?

    Not exactly sure, but usually 'multiple values'+'pipelined function' = some IN-LIST related approach?
    See:
    SQL> create table data as
      2  select 1 as t from dual union all
      3  select 2 as t from dual union all
      4  select 3 as t from dual union all
      5  select 4 as t from dual union all
      6  select 5 as t from dual;
    Table created.
    SQL> --
    SQL> CREATE OR REPLACE FUNCTION in_list (p_in_list  IN  VARCHAR2)
      2  RETURN sys.odcivarchar2list PIPELINED
      3  AS
      4    l_text  VARCHAR2(32767) := p_in_list || ',';
      5    l_idx   NUMBER;
      6  BEGIN
      7    LOOP
      8      l_idx := INSTR(l_text, ',');
      9      EXIT WHEN NVL(l_idx, 0) = 0;
    10      PIPE ROW (TRIM(SUBSTR(l_text, 1, l_idx - 1)));
    11      l_text := SUBSTR(l_text, l_idx + 1);
    12    END LOOP;
    13 
    14    RETURN;
    15  END;
    16  /
    Function created.
    SQL> --
    SQL> select *
      2  from   data
      3  where  t in ( select *
      4                from   table(in_list('1,2'))
      5              );
             T
             1
             2
    2 rows selected.http://www.oracle-base.com/articles/misc/dynamic-in-lists.php
    or
    http://tkyte.blogspot.nl/2006/06/varying-in-lists.html

  • Pass DB Link in procedure as parameter.

    Hi,
    I am using ORACLE Database 11g .
    I have a procedure in which i am already passing some parameters. The procedure contains few statements in which it has to refer to specific user for getting the data. So we use DB Link. As which user to connect is not sure so the DB LINK is also not constant. That is why i want to pass the DB link as a parameter to procedure. But if i don't give the db link name in procedure the procedure will not compile.
    A sample of my code is as follows :-
    create or replace procedure P_GET_TABLES(V_DBLINK in varchar2)
    as
    FOR I in (select s.TABLE_NAME
                    from user_tables@V_DBLINK s, dba_tables d          --- Obviously it gives me error that table does not exists.Due to variable V_DBLINK
                   where d.table_name = s.TABLE_NAME
                     and s.TABLE_NAME != 'ERROR_LOG'
                     and d.owner = V_SOURCE_SCHEMA_NAME
                  union (select s.TABLE_NAME
                          from user_tables@V_DBLINK s
                        minus
                        select TABLE_NAME
                          from dba_tables d
                         where owner = V_SOURCE_SCHEMA_NAME)) Loop
    -- other code for the process.....
    END LOOP;
    END;
    /Is their any method that i can pass a compiled procedure DB LINK as parameter or at run-time. ??
    Thanks in advance.

    VIRU wrote:
    Its a request can you just do the same thing with the FOR LOOP given by me in the first post. It will look something like this:
    create or replace procedure P_GET_TABLES
        (V_DBLINK in varchar2
          , V_SOURCE_SCHEMA_NAME  in varchar2)
    as
        rc sys_refcursor;
        l_table_name all_tables.table_name%type;
    begin
        open rc for 'select s.table_name
                    from user_tables@'||V_DBLINK||' s, dba_tables d
                   where d.table_name = s.table_name
                     and s.table_name != ''ERROR_LOG''
                     and d.owner = :1
                  union (select s.table_name
                          from user_tables@'||V_DBLINK||' s
                        minus
                        select table_name
                          from dba_tables d
                         where owner = :1)'
        using V_SOURCE_SCHEMA_NAME, V_SOURCE_SCHEMA_NAME;
       loop
            fetch rc into l_table_name;
            exit when rc%notfound;
            --  do your processing here....
       end loop;
       close rc;
    end P_GET_TABLES;
    /The Oracle online documentation covers dynamic SQL quite comprehensively. [url http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/dynamic.htm#i14500]Find out more.
    I think you have some confusion with the data dictionary views you're using, USER_TABLES@remote_db will look for tables in a schema with the same name as the current user in the local database. The current user in the local database has the privileges to read the DBA_ level views in te local data dictionary but apparently isn't the account owning the tables in the remote database.
    Is that right? It sounds like a mess. I have to [url https://forums.oracle.com/forums/thread.jspa?messageID=10062119#10062119]agree with Billy that you might be trying to solve the wrong problem. Perhaps you need better configuration/release management processes?
    Cheers, APC
    Edited by: APC on Jan 2, 2012 9:52 AM

  • Passing field name in function as parameter

    Hi
    I want to pass the fields name as in parameter in function and then return the value of that field.
    thanks
    pramod patel

    CREATE OR REPLACE FUNCTION demo
    (i_in IN number)
    RETURN NUMBER
    IS
    BEGIN
    RETURN i_in*2;
    END demo;
    Hope that helps ... also, remember you can't use precision and scale (in the case of NUMBER), or length (in the case of VARCHAR2) for the parameters but you can ANCHOR (%TYPE or %ROWTYPE)
    Good luck!

  • How to pass a value to the export parameter for a method (public instance)?

    Hello,
      I am trying ABAP OO newly. How to pass a value to the export parameter for a method (public instance) called in a report? This *export parameter has a reference type of structure.
    Thanks in advance,
    Ranjini

    Hi,
    "class definition
    class lcl... definition.
      public section.
        method m1 imporitng par type ref to data.  "now you can pass any reference to the method, but this way you have to maintain this reference dynamically inside the method (you can't be sure what that reference is really "pointing" at)
    endclass.
    "in program
    data: r_lcl type ref to lcl...
    create object r_lcl.
    call method r_lcl
      exporting
         par    =  "pass any reference variable here
    Regards
    Marcin

  • Passing different tables as a input parameter

    HI,
    I've 5 tables TAB1, TAB2, TAB3, TAB4, TAB5
    and I created 5 store procedures to generate 5 file.txt with utl_file utility.
    Now I'd like to know if possible create just one stored procedure (or package) with just one cursor
    that passing different tables as a input parameter.
    Have you any idea?
    Thanks in advance!

    Here you go...
    SQL> create table tab1 as select 1 as x, 'A' as y from dual union
      2                       select 2, 'B' from dual union
      3                       select 3, 'C' from dual;
    Table created.
    SQL>
    SQL> create table tab2 as select 4 as x, 'D' as y from dual union
      2                       select 5, 'E' from dual union
      3                       select 6, 'F' from dual;
    Table created.
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE output_tbl (p_table_name IN VARCHAR2) IS
      2    v_cur     SYS_REFCURSOR;
      3    x         NUMBER;
      4    y         VARCHAR2(10);
      5  BEGIN
      6    OPEN v_cur FOR 'SELECT x, y FROM '||p_table_name||' ORDER BY x';
      7    LOOP
      8      FETCH v_cur INTO x, y;
      9      EXIT WHEN v_cur%NOTFOUND;
    10      -- Here you would output to your file, but for ease of
    11      -- demonstration I'll just dbms_output the data
    12      DBMS_OUTPUT.PUT_LINE(x||' : '||y);
    13    END LOOP;
    14  END;
    15  /
    Procedure created.
    SQL> exec output_tbl('TAB1');
    1 : A
    2 : B
    3 : C
    PL/SQL procedure successfully completed.
    SQL> exec output_tbl('TAB2');
    4 : D
    5 : E
    6 : F
    PL/SQL procedure successfully completed.
    SQL>

  • Pass an array of buttons by parameter

    Dear Java developers :
    I am asking about how can I pass an array of JButton by parameter.
    For example, I have a method that randomly picks a button that have an empty text (""), if not empty then the method recursively calls herself and so on until it finds an empty labeled button :
    private void randomPick(JButton buttons[]) {
              Random r = new Random();
              int n = r.nextInt(8);
              if (buttons[n].getText()!="") {
                   countClicks--;
                   randomPick(buttons[n]);
              } else {
                   buttons[n].setText("O");
                   buttons[n].setEnabled(false);
              countClicks++;
         }The problem is that I don't know neither how to pass the buttons[] in parameter of a method nor how to write the calling of the method properly.
    Thanks for your help,
    Hassanova.

    Ok sorry for my explanations I'll try to be more clear :
    I have 2 classes at this point : one that draws the interface, the other makes the treatment
    here is the 1st class :
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    public class TTTGameJFrameView implements ActionListener {
         JFrame frame = null;
         JButton buttons[] = new JButton[10];
         public TTTGameJFrameView() {
              setView();
         public void setView() {
              // Building the window
              frame = new JFrame("Tic Tac Toe Game");
              frame.setSize(300,300);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setLayout(new GridLayout(3,3));
              //Positioning the buttons
              for(int i = 0; i<=8; i++){
                   buttons[i] = new JButton();
                   frame.add(buttons);
                   buttons[i].addActionListener(this);
         public void close() {
              frame.dispose();
         public void display() {
              frame.setVisible(true);
         @Override
         public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
    And here is the 2nd class where I don't know how to pass by parameter the buttons declared in the 1st class to the methods and hpw to call them properly....
    package test.TicTacToe;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    public class TTTGameModel {
         JButton buttons[] = new JButton[10];
         JFrame frame = null;
         JButton buttons[] = new JButton[10];
         private void setView() {
              // Building the window
              frame = new JFrame("Tic Tac Toe Game");
              frame.setSize(300,300);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setLayout(new GridLayout(3,3));
              //Positioning the buttons
              for(int i = 0; i<=8; i++){
                   buttons[i] = new JButton();
                   frame.add(buttons);
                   buttons[i].addActionListener(this);
              frame.setVisible(true);
         private int[][] winPositions = new int[][] {
                   {0,1,2}, {3,4,5}, {6,7,8},
                   {0,3,6}, {1,4,7}, {2,5,8},
                   {0,4,8}, {2,4,6}
         private int countClicks = 0;
         private boolean win = false;
         private String buttonLetter = "";
         private String xOrO = "";
         public void actionPerformed(ActionEvent e, JButton buttons[]) {
              for(int i=0; i<=8; i++) {
                   if(e.getSource().equals(buttons[i])) {
                        buttons[i].setText("X");
                        buttons[i].setEnabled(false);
              if ((countClicks <= 8) && (win==false)) {
                   randomPick(buttons);
                   countClicks++;
                   whoWins(buttons);
                   System.out.println("click�");
              //System.out.println(countClicks);
         private void whoWins(JButton buttons[]) {
              for (int i=0; i<=7; i++) {
                   if (buttons[winPositions[i][0]].getText().equals(buttons[winPositions[i][1]].getText()) &&
                        buttons[winPositions[i][1]].getText().equals(buttons[winPositions[i][2]].getText()) &&
                        buttons[winPositions[i][0]].getText()!="")
                        win = true;
              System.out.println(countClicks + " " + win);
              showWinner(win,countClicks);
         private void showWinner(boolean isWin, int count) {
              if(count % 2 == 0)
                   xOrO = "O";
              else
                   xOrO = "X";
              if (isWin == true){
                   JOptionPane.showMessageDialog(null,"The "+xOrO+" Player Wins!");
                   System.exit(0);
              else if ((isWin == false) && (count >= 9)){
                   JOptionPane.showMessageDialog(null,"Draw Game");
                   System.exit(0);
         private void buttonClick(ActionEvent e) {
         private void randomPick(JButton buttons[]) {
              Random r = new Random();
              int n = r.nextInt(8);
              if (buttons[n].getText()!="") {
                   countClicks--;
                   randomPick(buttons[n]);
              } else {
                   buttons[n].setText("O");
                   buttons[n].setEnabled(false);
              countClicks++;
         private void randomPick(JButton button) {
              // TODO Auto-generated method stub
         public static void main(String[] args) {
              TTTGameJFrameView tt = new TTTGameJFrameView();
              tt.setView();
              tt.display();
    Thank you very much I appriciate your patience !
    Hassanova.

  • DAQ Buffer... What to pass to the "d as Any" parameter in DAQ_Start

    "While trying to run DAQ_Start(...), I am crashing due to memory access violation. The only thing I can provide so far for this parameter was a Long I declared that stored the reference returned from GlobalAlloc (WinAPI call) passed to DAQ_Start in place of the "d as Any" parameter. The documentation claims that it expects an array of integers though in the provided DLL for my hardware the function has a different parameter type. Am I passing the wrong thing and if so, what do I pass to this function for this parameter?"
    Attachments:
    Sample.txt ‏1 KB

    Well thats straight out of the documentation, which I already knew, but thanks anyway... I found the solution.
    Visual basic wants an address of the memory location. Since VB handles most things as ptrs without you knowing and thus to pass an array you would usaully pass byref. However, based on the type expected this would not work. I was trying other ways to simply pass the address of my array (reference) however they never worked. Finally I was racking my brain for other ways to pass something by reference and recalled that iun C/C++ I could pass the first element. I never imagined this would work VB, but it did. After further investigation, I realized that passing arrays to DLLs when using VB is special and you have to treat the function
    as though it were C.

Maybe you are looking for

  • Can we limit the no of line items in a Sales Order

    Can we limit the no of line items in a Sales Order.

  • Oracle 10 Express Edition, SID, DBNAME

    Hi i'm from Russia and my english is very bad! Please, help! I'm use Oracle 10 Express Edition and i have a problem: My soft use speciefied database name, how i can (and may be then) rename SID and DBNAME? I .. change instance with "oradim" ,and chan

  • Adding extra Field to a Infoset Query

    Hi Experts,   I need to add an extra field to a SAP Query(infoset). SInce the code uses a dynamic program call, how do I add my code . Can I have some example code used to add extra field to a SAP Query

  • SAP Business Objects BI Platform 4.0 SP2 Patch 7 setup

    Hello Everyone We have BOXI 4.0 installed on the DEVELOPMENT system. I have been asked to update it to patch 7. I am installing SP2 Patch 7 setup. In one of the installation screens it asks for Connection Information for Existing CMS CMS NAME: CMS Po

  • Esitable alv, n update in database

    HI Experts, How to make an Editable ALV, and if i changed the field content that should update in database. can you give me a solution thru function modules and oops concepts.