Skip to Content
author's profile photo Former Member
Former Member

A question about WebService Result

Hi .. I have added a method in my EJB and wish to expose by WebService to be imported into model in WebDynpro Project . Here is my code ...

public Object[] Test1() {

// TODO : Implement

List AA = new ArrayList() ;

AA.add( new String[]{"123" , "456"} ) ;

AA.add( new String[]{"abc" , "def"} ) ;

return ( AA.toArray( new Object[AA.size()]) ) ;

}

After deploy to WAS , I test it in the WebService Test Page , and the resule just as listed below ..

Test1

 |-- response (test.types.p1.Test1Response)

  |-- Response (Object[])

   |-- (Object) [v]NULL

   |-- (Object) [v]NULL

But this is not what i expected . The actual result i expect would like this ...

Test1

 |-- response (test.types.p1.Test1Response)

  |-- Response (Object[])

   |-- element1 ( String[] )

   |-- element2 ( String[] )

Can any one help to verify where the problem is or give me any suggestion ?? Thanks for your help ...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jun 08, 2004 at 11:15 AM

    Hi Bogi,

    Your WS returns null due to the String array type has not been described in the Virtual Interface. Thus the WS Framework is not able to serialize the returned String array object.

    As a solution you may create a new complex type that implements Serializable and contains the String array as a field. You will also have to add this new complex method manually in the Virtual Interface. Types are added automatially, when they are part of the signature of a method

    Another way is to define another method that returns a String array.

    Best regards,

    Alexander

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Alexander , Thanks for your reply .. I found it work if i replace the String[] with Object[] in my EJB code and I can translate it into String in WebDynpro ... Any way , i will try the solution you supply ... Thanks a lot !!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.