1 Reply Latest reply on Jun 28, 2006 4:13 AM by heiko.braun

    Complex types in SOAP messages?

    notarzt-hd

      Hi,

      I?am trying to send a XML message to my SOAP client using the @WebService- and @WebMethod-annotation (on a Jboss4.0.4GA).
      My client needs such a XML-Message like:


      <employee id=?50? name=?peter? street=?backerstreet 5? city=?London? >
      <employee id=?51? name=?alex? street=?lamestreet 18? city=?Dresden? >


      I know that this is not the best XML-style! But my SOAP client asks for such a message and I have to implement it like that.

      I have already implemented an EJB3-Entity-Bean for ?employees? with the above attributes.

      All the examples about WebService-Endpoints in EJB3 under Jboss were implemented with an ordinary String- or int-returnvalue.

      As I for sure need a complex type return value, now my idea was: to give to the client an array of employee-Entity-Beans within the WebService. But this appears to be not the right thing: the resulting WSDL-Document (created automatically by JbossWS) does not contain the private attributes but other stuff, which does not give me the possibility to get the XML-Message like shown above.

      Another idea was to return a String[][] with the values of the attributes only. This results in such a XML Message as:

      peterLondonalexDresden

      I thought also to write for each Return-Value-Entry a class, to wrap the values:

      public class myObject { public id; public name; public street; public city;}

      and to return to the client an array of this class?s objects.
      Resulting XML-Message:

      50peterbackerstreet 5London


      51alexlamestreet 18Dresden


      After all I stuck here, because I don?t know how to write the EJB3-Session-Bean-Method with the use of the @WebMethod annotation, to get the wished XML-SOAP-Message.

      Anybody has any ideas how to implement that or where to get ?docu? about EJB3-Session-Beans as WebService Endpoints and complex types? (I already have the O?reillys ?Enterprise JavaBeans 3.0? -> no information about that!)

      Thx for your help, Michael