Archived

This forum has been archived. Please start a new discussion on GitHub.

Java StringHolder problem

Hello -

I have Java application which has an Ice client talking to an Java Ice server as a test stub - the final server will be in another language. The interface on the server has an operation on it with the following SLICE definition:

void executeFunction( string funcName, string input, out string output, out string tables) throws XmlParseError;

slice2java turns the first two parameters into Java String types, and the output and tables parameters into StringHolder types, as expected.

The strings come through from the client to the server correctly. However, the value fields of the StringHolder parameters come through as null. I have logged the value field of the output parameter immediately before the call on the client and it looks fine; but, when the method is invoked on the server value fields are null.

Other operations on the interface involving strings work correctly. Any ideas what could be the problem.

- Robert Haar

Comments

  • mes
    mes California
    Hi Robert,

    Welcome to the forum!

    Section 4.10.1 of the Ice manual explains the semantics of out parameters:
    Slice does not support parameters that are both input and output parameters (call by reference).
    Any value that a client might store in a holder is ignored by the Ice run time and consequently is not transmitted when the request is marshaled. This explains why the holder's value is null in the server.

    Cheers,
    Mark
  • Thanks for the quick response - I missed that important point.
    Should be easy to work around though.

    - Robert Haar