cancel
Showing results for 
Search instead for 
Did you mean: 

A question about WebService Result

Former Member
0 Kudos

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 ...

Accepted Solutions (0)

Answers (1)

Answers (1)

zubev
Employee
Employee
0 Kudos

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

Former Member
0 Kudos

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 !!