1 Reply Latest reply on Apr 15, 2010 8:07 PM by billzhang1123

    consume web service with complex data type

    billzhang1123

      I have been playing with webservice_consumer1 sample in JBoss ESB.  I modified the sample code to invoke another web service which has an array of string as input parameter along with another String type paramter. Here is my code of process method in webservice_consumer1 MyRequestAction method. No changes on jboss-esb.xml.

       

       

      public Message process(Message message) throws Exception
      {
        logHeader();
        String msgBody = (String) message.getBody().get();

        HashMap requestMap = new HashMap();
       
        String[] arrayOfStr = new String[2];
        arrayOfStr[0] = "b";
        arrayOfStr[1] = "b1";

       
        requestMap.put("sayHello.arg1.name", "vicky");
        requestMap.put("sayHello.arg1.kids", arrayOfStr);

      message.getBody().add(requestMap);

      }

       

      After I ran the SendJMSMessage, on the web service side I can see the incoming value of name which is a String type. However web service can only see the number of elements but not the values. If I use SOAPUI to call the service I can see the array of kids that I send.

       

      Therefore, I guess the use of 'requestMap.put("sayHello.arg1.kids", arrayOfStr);' is wrong for array as input. Can someone please give me a hint of how to send an array of string using HashMap? Thanks.