2 Replies Latest reply on Aug 31, 2006 3:17 AM by Thomas Diesler

    passing arrays to ejb3 WS

    Stefan Krecher Newbie

      Hello,
      i'm using jboss 4.0.4 GA with jbossws 1.0.2 GA
      I've deployed a SLSB as Webservice:

      @WebService(name = "ImportEndpointInterface",
       targetNamespace = "myns",
       serviceName = "ImportService")
      
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      @Stateless
      public class ImportBean {
      
      
       @WebMethod
       public String putArray( @WebParam(name = "mystrings") String[] mystrings ) {
       ...
       return "OK";
       }
      ...
      }
      


      I'd like to use the WS via DII Client like this:
      ...
      call.setOperationName( new QName( "myns", "putArray") );
      call.setProperty( Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE );
      call.setProperty( Call.SEND_TYPE_ATTR, Boolean.TRUE );
      call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped" );
      call.addParameter( new QName( "", "mystrings" ), XMLType.SOAP_ARRAY, ParameterMode.IN );
      String[] l = new String[] {"a", "b", "c"};
      call.invoke( new Object[] { l } );
      

      With simple data-types like "String" evrything works as expected, but when I pass an array like in the above example, the elements of the String[]-Array in the Webservice-method look like this:
      <item>a</item>, <item>b</item>" and <item>c</item>
      - not just "a", "b" and "c".
      The transmitted message looks like this:
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
       <putArray xmlns="myns">
       <mystrings xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="">
       <item>a</item>
       <item>b</item>
       <item>c</item>
       </mystrings>
       </putArray>
       </soapenv:Body>
      </soapenv:Envelope>
      


      i use the wsdl which was generated during deployment to create the Service-object with the ServiceFactory.

      here an exerpt from the generated file:
      <message name="ImportEndpointInterface_putArray">
      <part name="mystrings" type="xsd:NMTOKENS"/>
      </message>
      


      it makes no difference when I use the XMLType.XSD_NMTOKENS for the addParameter-call:
      call.addParameter( new QName( "", "mystrings" ), XMLType.XSD_NMTOKENS, ParameterMode.IN );
      


      What am I doing wrong here? I only want to get the strings out of the array without those "item"-markups.

      regards,
      Stefan