7 Replies Latest reply on Feb 27, 2008 2:44 AM by oskar.carlstedt

    out parameter

    rukus

      Hello All!
      Is there any way to create out parameters for web-methods?

      For example:
      String get_out_param(MyClass outParameter);

      When invoking this method outParameter state may be changed in method and returned to ws-client.

        • 1. Re: out parameter
          rukus

          nobody knows? :)

          • 2. Re: out parameter
            heiko.braun

            I think nobody understands what you are asking for ;)

            • 3. Re: out parameter
              rukus

               

              "heiko.braun@jboss.com" wrote:
              I think nobody understands what you are asking for ;)

              hmm - ok, maybe this let others to understand what i want:
              For example we have:
              @WebMethod public void get_parameter(String outParam) {
              outParam="Test";
              }
              

              When we invoke this webmethod from client:
              String param="empty";
              myservice.get_parameter(param);
              System.out.println(param); //output Test instead empty


              • 4. Re: out parameter
                rukus

                *upd: instead of string may be user-defined object

                • 5. Re: out parameter
                  oskar.carlstedt

                  Hi!

                  In such cases you have to return the new "state" to the client in form av a returned object. So you cannot have this method as a void method.

                  Cheers
                  /Oskar

                  • 6. Re: out parameter
                    rukus

                     

                    "oskar.carlstedt" wrote:
                    Hi!

                    In such cases you have to return the new "state" to the client in form av a returned object. So you cannot have this method as a void method.

                    Cheers
                    /Oskar


                    i know that i can return new state of object by using "return" statement but this isn't what i need

                    • 7. Re: out parameter
                      oskar.carlstedt

                      Hi again!

                      Now I look at all these parts on a communication level. There might be a feature in JAXB to do all this state synchronization without your/my knowledge. I don't know. But the concept of web services does not support this kind of void feature where you change a value in your method "argument" - because there is no method or argument just an operation that accepts a message.

                      This is something you already know, but we take it from the beginning if there are other persons whoe are unsure about the concept of web services.

                      Web services, in this case SOAP, provide a stateless way to communicate with other components. You never know if these components are written in Java, .NET, Perl, C++ or whatever else. This is the whole point by using web services - You send a request message to a component and you get a response message in return.

                      Web services also use http as communication protocol. Http is a so called dead protocol, i.e. one request and then one response before the communication dies (we have something call keep alive to speed up things but that is just a way to keep the socket connection open).

                      To summarize, we have two stateless parts communicating with each other - or more correct one part (the client) asking the server for something by providing a message. The response is another message. The two parts don't know anything about each other more than what is exposed by the service contract (the WSDL file).

                      The question is, how can we provide the client with a new state on the server. Can it be exposed to the client in another way than by using a return statement? I don't think so.

                      Maybe JAXB can solve a void method by automatically map the contents of your request Java-object instance to the same instance as the response Java-object.


                      Cheers
                      /Oskar