Reference HttpServlet object from webservice method ...

How to reference HttpServlet object from webservice method to access HTTP header?
Thanks
Marcel

You are correct.
I know that SOAP messages can be send not only via HTTP protocol.
Our solution is restricted to use only HTTP protocol for communication between client and server by customer, because there is implemented transparent proxy for users authorization and strong security of communication via HTTP protocol. Authorization server transparently modify HTTP request header with user identity (DN from user certificate - with this PKI solution it is not possible to use standard SSL because certificate is proprietary enhanced and cannot be accessed in standard way). That is why I need access HTTP request header.
Why I want to use webservices? I thing that webservice is flexible and perspective technology for integration and asynchronous communication between web clients and application (it is really more effective add new info in web page asynchronously from webservice than reload whole page).
Thanks
Marcel

Similar Messages

  • How can i return an object isn't java object from webservice????

    Hi !
    I have a problem in my Project. When i call method return a java object from webservice , it 's too easy. But when i create my own object (ex:ClientRequest.class) , it doesn't work exactly T_T . When i return that object (on client, doesn't have ClientRequest.class) , i cann't access its static variables.
    How can i do it ??
    Please help me !
    Thanks a lot !!!!!
    class ClientRequest {
    public static int i;
    public static String s;
    public ClientRequest() {
    }

    You can use REFCURSOR type for this. In java SQL TYPES this is available too. In your PLSQL use REFCURSOR for that array and then take the same from java code. Look in the servelet programming book for this SQLTYPE and see PLSQL for handling refcursors. We have done this way and it works.

  • How to return a object from a method in a java program to a C++ call (JNI )

    Sir,
    I am new to java and i have been assigned a task to be done using JNI.
    My question is,
    How can i return an object from a method in a java program to a call for the same method in a C++program using JNI.
    Any help or suggesstions in this regard would be very useful.
    Thanking you,
    Anjan Kumar

    Hello
    I would like to suggest that JNI should be your last choice and not your first choice. JNI is hard to get right. Since the JNI code is executing in the same address space as the JVM, any problems (on either side) will take down the entire process. It dilutes the Write Once Run Anywhere (WORA) value proposition because you need to provide the JNI component for all hardware/OS platforms. If you can keep your legacy code(or whatever you feel you need to do in JNI) in a separate address space and communicate via some inter-process channel, you end up with a system that is more flexible, portable, and scalable.
    Having said all that, head over to the Java Native Interface: Programmer's Guide and Specification web page:
    http://java.sun.com/docs/books/jni/
    Scroll down to the Download the example code in this book in ZIP or tar.gz formats. links and download the example source. Study and run the example sources. The jniexamples/chap5/MyNewString demo creates a java.lang.String object in native code and returns it to the Java Language program.

  • How get java Object from webservice

    Hai
    i gave ArrayList<bean> , i can't get this ArrayList<bean> from webservice. How can i get ? via for each or iterator or any ?????
    Note: i iterated  but only one element was come from bean property  using next() of iterator .
    I need all property. any one please help.
    thanks
    Mr...Javan

    Try to return an Array instead of an ArrayList?
    Have a look at http://forums.sun.com/thread.jspa?forumID=331&threadID=5289022.

  • Oracle ADF Mobile getting array of objects from webservice

    hi,
    i am trying to fetch a certain number of records using a webservice call and then storing in the SQLLite DB in the mobile.
    i understand i can create a data control using the webservice > then?
    my webservice returns an array of objects.
    how can i do that?
    regards,
    ad

    It's fairly easy.
    What I have done is created a WebService Controller (plain java class) which calls the methods (from the WS) programmaticly.
    Example :
    public class WSController {
        private final String WSDataControllerName = "ThisIsTheNameOfMyWebserviceDataControl";
        private List pnames ,ptypes ,params;
        public WSController() {
            super();
        public List getAllActioncodesFromWS()
           //start - WS empty params
            pnames = new ArrayList();
            params = new ArrayList();
            ptypes = new ArrayList();
            pnames.add("findCriteria");
            params.add(null);
            ptypes.add(Object.class);
            pnames.add("findControl");
            params.add(null);
            ptypes.add(Object.class);
            //end - WS empty params
            List actionCodes = new ArrayList();
            try
                GenericType result = (GenericType)AdfmfJavaUtilities.invokeDataControlMethod(WSDataControllerName, null, "findActioncodesView1",pnames, params, ptypes);
                if(result!=null)
                    for (int i = 0; i < result.getAttributeCount(); i++)
                        GenericType row = (GenericType)result.getAttribute(i);
                        Actioncode wd = (Actioncode)GenericTypeBeanSerializationHelper.fromGenericType(Actioncode.class, row);
                        actionCodes.add(wd);
            catch (AdfInvocationException e)
                e.getMessage();
            catch (Exception e)
                e.getMessage();
         return actionCodes;
        }I also defined a Pojo named Actioncode :
    Note that the attribute names are completly the same as the VO from the web service.
    public class Actioncode {
        String Actioncode,Descript1;
        public Actioncode() {
            super();
        public Actioncode(String Actioncode, String Descript1) {
            super();
            this.Actioncode = Actioncode;
            this.Descript1 = Descript1;
        public void setActioncode(String Actioncode) {
            this.Actioncode = Actioncode;
        public String getActioncode() {
            return Actioncode;
        public void setDescript1(String Descript1) {
            this.Descript1 = Descript1;
        public String getDescript1() {
            return Descript1;
    }Since the WS method returns a GenericType, you can 'convert' that object to an POJO.
    Read more about it here :
    http://adf4beginners.blogspot.be/2013/01/adf-mobile-how-to-iterate-over-all-rows.html
    I know the blog post is about iterating over rows in an iterator, but it's just to illustrate how you can work with the GenericType

  • Anyway of accesing object from loadView() method?

    Hi Everybody,
    I am doing one application in which i am using different method for tableView.
    In have two UIViewController class
    1. firstViewController
    in loadView() metohd i have created one myView , common view , for all others sub views.
    2. secondViewController
    another sub vies i have to access myview from loadView of firstViewController but i can't understand what to do?
    Please tell me any body it would appreciated
    Thank you.

    I found a way of opening attachments to a specific bookmark. It ain't pretty but it works. If anybody needs the script, let me know.
    Kyle

  • Retun of object or Array From webservice

    Thanks pekka,
    you are right...
    It is also possible to manage the ByteStream by returning the byte[] array from web services, but the issue is when the response reaches to the client... the invoke method returns object ...as
    byte[] ret = (byte[]) call.invoke( new Object[] { "Any String" } );
    At this point the axis server throws an error.... regarding the cast of Object type to byte array... (ClassCastException)... Due to this error i thought to return ByreArrayOutputStream object from webservice function......
    Although the return of byte[] will also work for me.... but the wholw issue struck at client at client side during typecasting of returned object from web services.....
    please suggest any solution.... for its casting...
    Thanks Very much...
    Gaurav

    Dear jpday,
    Have you seen this tutorial?
    Web Services in LabVIEW 
    http://zone.ni.com/devzone/cda/tut/p/id/7350
    attached to it you will find a zip file named webservicesdemo. This demo contains a VI called Function Generator Main, which shows how to convert an array to an XML string, which you can then output from the web service VI (Function Generator Main shows how to do this). 
    Hope this helps!
    ~Nate 

  • Good design choice, different types of customers, from webservice

    Hi, I have thoughts about good design pattern, when doing this:
    You have a webservice where customers coming into your system. The customers are private ones, business ones, and big business types.
    These 3 customer types has different needs, and must have different values like companyname, social security number, etc etc.
    The customer also has some shared types, like customerid, created, updated, etc.
    So what you want to do is to have an interface or an abstract class containing common methods for the customer, then you will create subclasses for the different types.
    I was thinking about creating a factory class and pass in the customer object retreived from the webservice, and in the factory process method create objects on the different subclasses based on what kind of object you get in (private, business, etc).
    So, webservice gets a private customer object, you serialize it and then you pass it into your factory class. And back you get a customer object.
    Now you want to do business logic on the object, storing it to a database, etc.
    So you might still have to create different scenarios based on if its customer type.
    The basic idea is that you want to get the object from webservice, pass it to a factory and get back a customer object which you want to do things with.
    What do you think, what is a good design solution to the problem described?

    To be clear "pattern" has a specific meaning. Your description is a design not a pattern.
    Is the small business one never going to become a big business one?
    Is a big business one never going to become a small business one?
    If the answer to either is yes, then you have one entity with different attributes, not two.
    I have no idea why serialization would matter in this. And your description doesn't explain that either. If you are talking about communication between different boxes then you need a communication layer (and it doesn't appear you are at the level yet where you need to decide the specifics of how that is handled.)
    It is unclear why you would want a factory. But if you just want the experience then you could probably use it.
    Your description isn't nearly complete enough to define how the overall system should behave which is what you seem to be also describing. You need to seperate what the system will do for how it will do it (the design.)

  • How to return more than one varibles from a method?

    can you use the codes:
    return var1, var2,var3;
    If not, what is the correct way to do so? thanks.

    You can only return 1 object from a method in Java.
    However, this 1 object can contain multiple other objects. For example, a Vector object:
      public Vector someMethod() {
        Vector v = new Vector();
        v.add("abc");
        v.add("xyz");
        v.add("123");
        return v;
      }If these multiple objects are the same type, you can also use array to achieve want you want.
      public String[] someMethod() {
        String ss = new String[3];
        ss[0] = "abc";
        ss[1] = "xyz";
        ss[2] = "123";
        return ss;
      }--lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get caller object reference from a method

    Hi,
    I am working a already existing Java Swing project, now I got a problem, in a method I need to get the caller object reference otherwise, I can't succeed this operation. So please tell me a way how to get the caller object reference from a method. that method would be static or regular method anything will do for me.
    Edited by: navaneeth.j on Jan 29, 2010 11:20 PM

    navaneeth.j wrote:
    Actually my doubt is, I have a method "addition" method, which is using by many classes so my requirement is in the addition method I want to write a code snippet which will identify and get the the caller object. Actually I tried Reflection.getcallerclass but there I am getting "CLASS" object not the actual object reference, but I want object reference.
    Actually we have a huge project which is writen plain JAVA, so in this project the authors written the Database connection package for single database transaction. so now we are using this project source code for JSF application in this web application the DB package has serve based on the dynamic db connection parameters, so if we want to change this package fully means need to solve the dependency problem in hundreds of classes, so my point is if I can access the caller object in the DB package when ever it gets called by any class from any where of the project. So actually I liked Reflection.getcallerclass, the way of implementation perfectly works for me but it is not giving caller object reference, if something gives the caller object then I can get the DB connection parameters then there is no need to pass the parameters in the hierarchy.You can add a parameter (of type Object) to your addition() method
    and everywhere you call the addition() method also pass this (which from the POW of the addition() method will be a reference to the calling class instance).
    There may be alternative solutions
    but none that require less effort.

  • How to reference multiple instances of the same Java object from PL/SQL?

    Dear all,
    I'm experimenting with calling Java from PL/SQL.
    My simple attempts work, which is calling public static [java] methods through PL/SQL wrappers from SQL (and PL/SQL). (See my example code below).
    However it is the limitation of the public static methods that puzzels me.
    I would like to do the following:
    - from PL/SQL (in essence it needs to become a forms app) create one or more objects in the java realm
    - from PL/SQL alter properties of a java object
    - from PL/SQL call methods on a java object
    However I fail to see how I can create multiple instances of an object and reference one particular object in the java realm through public static methods.
    My current solution is the singleton pattern: of said java object I have only 1 copy, so I do not need to know a reference to it.
    I can just assume that there will only ever be 1 of said object.
    But I should be able to make more then 1 instance of an object.
    To make it more specific:
    - suppose I have the object car in the java realm
    - from PL/SQL I want to create a car in the java realm
    - from PL/SQL I need to give it license plates
    - I need to start the engine of a scpecific car
    However if I want more then 1 car then I need to be able to refrence them. How is this done?
    Somehow I need to be able to execute the following in PL/SQL:
    DECLARE
    vMyCar_Porsche CAR;
    vMyCar_Fiat CAR;
    BEGIN
    vMyCar_Porsche = new CAR();
    vMyCar_Fiat = new CAR();
    vMyCar_Porsche.setLicensePlates('FAST');
    vMyCar_Porsche.startEngine();
    vMyCar_Fiat.killEngine();
    END;
    Thanks in advance.
    Best Regards,
    Ruben
    My current example code is the following:
    JAVA:
    ===
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED CODAROUL."RMG/BO/RMG_OBJECT" as package RMG.BO;
    public class RMG_OBJECT {
    private static RMG_OBJECT instance = new RMGOBJECT();
    private String rmgObjectNaam;
    private RMG_OBJECT(){
    this.rmgObjectNaam = "NonDetermined";
    public static String GET_RMGOBJECT_NAAM () {
    String toestand = null;
    if (_instance == null) {toestand = "DOES NOT EXIST";} else { toestand = "EXISTS";};
    System.out.println("instance : " + toestand);
    System.out.println("object name is : " + _instance.rmgObjectNaam);
    return _instance.rmgObjectNaam;
    public static Integer SET_RMGOBJECT_NAAM (String IN)
    try
    _instance.rmgObjectNaam = IN;
    return 1;
    catch (Exception e)//catch
    System.out.println("Other Exception: " + e.toString());
    e.printStackTrace();
    return 5;
    } //catch
    PL/SQL Wrapper:
    ==========
    CREATE OR REPLACE FUNCTION CODAROUL.SET_RMGOBJECT_NAAM(NAAM IN VARCHAR2) return NUMBER AS
    LANGUAGE JAVA NAME 'RMG.BO.RMG_OBJECT.SET_RMGOBJECT_NAAM (java.lang.String) return java.lang.Integer';
    Calling from SQL:
    ==========
    CALL dbms_java.set_output(2000);
    select CODAROUL.GET_RMGOBJECT_NAAM() from dual;
    Edited by: RubenS_BE on Apr 6, 2012 5:35 AM
    Edited by: 925945 on Apr 6, 2012 5:41 AM

    You can do this by manually creating a new iterator binding in your binding tab.
    So instead of dragging the VO directly to the page, go to the binding tab, add a new executable iterator binding, and point to that one from your ELs in the page itself.

  • How to export a reference to a table line from a method?

    Hello,
    I have a class which has a hashed table as an attribute. I want to retrieve a line from the table using the key and return a reference to the table line. I want changes to the return value of the method to be directly reflected in the table, as if using a local field symbol. I have tried to approaches, neither of which works.
    First, I returned a reference to the local field symbol. This dumps, because after returning from the method call, the target of this reference no longer resides on the stack.
    Second, I have tried using an export parameter marked as "pass by reference", i. e. without VALUE(). Strangely, this still seems to give me only a copy of the data.
    What is the correct way to proceed?
    Illustrative pseudo-code follows.
    Thanks, Sebastian
    *==============================================================
    *Possibility 1: (using references)
    DATA mt_key_map TYPE zt_entity. " member variable (hash table of zs_entity)
    METHODS get
        IMPORTING
          !is_key TYPE zs_key
        EXPORTING
          !er_vt TYPE REF TO zs_entity.
    METHOD get.
      FIELD-SYMBOLS: <fs_vt> TYPE zs_entity. 
      READ TABLE mt_key_value WITH KEY key = is_key ASSIGNING <fs_vt>.
      GET REFERENCE OF <fs_vt> INTO er_vt.
    ENDMETHOD.     
    " Client Code:
      FIELD-SYMBOLS: <fs_vt> TYPE zs_entity. 
      CALL METHOD get
        EXPORTING
          is_key        = is_key
        IMPORTING
          er_vt         = lr_vt.
      ASSIGN lr_vt->* TO <fs_vt>.  " will dump, because the local field symbol
                                   " to which lr_vt points is no longer on the stack
      <fs_vt>-value = 'newdata'.       
    *==============================================================
    *Possibility 2:  (using a structure passed by reference)
    DATA mt_key_map TYPE zt_entity. " member variable (hash table of zs_entity)
    METHODS get
        IMPORTING
          !is_key TYPE zs_key
        EXPORTING
          !es_vt TYPE zs_entity.  
    METHOD get.
      FIELD-SYMBOLS: <fs_vt> TYPE zs_entity. 
      READ TABLE mt_key_map WITH KEY key = is_key ASSIGNING <fs_vt>.
      es_vt = <fs_vt>.
    ENDMETHOD.   
    " Client Code:
      DATA: ls_vt TYPE zs_entity.
      CALL METHOD get
        EXPORTING
          is_key        = is_key
        IMPORTING
          es_vt         = ls_vt.
      ls_vt-value = 'newdata'.   " will not change the contents of the
                                 " table mt_key_value       

    In the first approch, try to change the exporting parameter type REF TO DATA.
    Try like:
    CLASS lcl_test DEFINITION.
      PUBLIC SECTION.
        DATA: t_mara TYPE HASHED TABLE OF mara WITH UNIQUE KEY matnr.
        METHODS:
          constructor,
          get
            IMPORTING
              if_matnr TYPE matnr
            EXPORTING
              ea_mara  TYPE REF TO data.
    ENDCLASS.                    "lcl_test DEFINITION
    START-OF-SELECTION.
      DATA: lo_test TYPE REF TO lcl_test,
            lr_data TYPE REF TO data.
      FIELD-SYMBOLS: <fa_mara> TYPE ANY,
                     <f_field> TYPE ANY.
      CREATE OBJECT lo_test.
      lo_test->get(
        EXPORTING
          if_matnr = '000000000077000000'   " << Replace Your Material
        IMPORTING
          ea_mara  = lr_data ).
      ASSIGN lr_data->* TO <fa_mara>.
      ASSIGN COMPONENT 'ERSDA' OF STRUCTURE <fa_mara> TO <f_field>.
      <f_field> = space.
      WRITE: 'Done'.
    CLASS lcl_test IMPLEMENTATION.
      METHOD constructor.
        SELECT * INTO TABLE t_mara
               FROM mara
               UP TO 10 ROWS.
      ENDMETHOD.                    "constructor
      METHOD get.
        FIELD-SYMBOLS: <lfs_mara> LIKE LINE OF me->t_mara.
        READ TABLE me->t_mara ASSIGNING <lfs_mara> WITH KEY matnr = if_matnr.
        GET REFERENCE OF <lfs_mara> INTO ea_mara.
      ENDMETHOD.                    "get
    ENDCLASS.                    "lcl_test IMPLEMENTATION
    Regards,
    Naimesh Patel

  • Get a reference to an object from a touch

    I have no idea how to get the reference to an UIImageView object from a touch gesture. So far all I know how to do is get a reference to the touch. This is the code I have so far:
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    printf("TOUCH ");
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:self.view];
    Any help would be greatly appreciated

    There may be more elegant methods, but what I did was to find out which sub views bounds covered the coordinates of the selected point. My task was easy since I had a sudoku grid, so converting coordinates into the index into an array of view instances was easy.
    - (unsigned int) setSelectedIndexForXCoordinate:(float) x YCoordinate:(float) y
    int column = (int) ( ( 9.0 * x ) / 320.0 );
    int row = (int) ( ( 9.0 * y ) / 320.0 );
    unsigned int index = ( ( row * 9 ) + column );
    [self setSelectedIndex:index];
    return index;

  • Pass an object from a static method

    Hi,
    I'm trying to pass a reference to an object from a static method, but I get an error when compiling.
    Say for example I have this:
    public class obj1 {
    public void myMethod (int i, Object ob, etc...) {
    ...and I want to call this method from a method that looks like this:
    public class obj2 {
    public static int anotherMethod(...) {
    obj1.myMethod(1,this,...);
    ...Can I pass a reference from obj2 to obj1 any other way?
    Thanks alot.

    how can I get a reference to obj2 then?Pay no attention to zdude's answer - it's nonsense.
    You're confused about basic Java concepts. obj2 is a class, not an object. References point to objects, not classes. There is no obj2 object in the code you show, so you cannot have a reference to an obj2 object.
    Maybe if you post some more code, we can get an idea of what you're trying to do. You might want to try the New to Java forum.

  • How do a reference a container from one of its objects?

    If i have on object in a container, how do i reference the
    container from inside the object. For instance, if i have
    a textbox and i want it to change color depending on
    a value in the container, how do i get to the container.
    thanks for any help
    owen brandon

    If you are asking about AWT or Swing, the Component class has a getParent() method that returns a Container.

Maybe you are looking for