1 Reply Latest reply on Feb 13, 2012 11:38 AM by spyhunter99

    How can I create Java web service (jax-ws) with array or List as a parameter

    faber81

      How to invoke a list of parameters and a string parameter

       

      URL wsdlLocation;

                          String messaggio="";

                          try {

                                    wsdlLocation = new URL("http://localhost:8080...................................?wsdl");

       

                                    String ns = "http://impl.businesslogic/";

                                    QName serviceName = new QName(ns, "ServiceBL");

                                    QName port = new QName(ns, ServiceBLPort");

                                    QName operation = new QName(ns, "executeService");

       

       

                                    ServiceFactory factory = ServiceFactory.newInstance();

                                    Service service = factory.createService(wsdlLocation, serviceName);

       

                                    Call call = service.createCall(port, operation);

       

      Object rispostaWS = call.invoke(new Object[]{new List<String>command, new String(ID)});

                                    messaggio = (String)rispostaWS;

       

      this is my method but throws error.

        • 1. Re: How can I create Java web service (jax-ws) with array or List as a parameter
          spyhunter99

          I'd suggest making it a wrapped class. So...

           

          class listcontainer
          {

          public List<String> command;

          public String ID;

          }

           

          then your web service

           

          public String invoke(listcontainer request)

           

           

          or something like that. I'd suggest always writting WSDL first. It gives you the best flexiblity and control for defining this stuff. Assuming your using SOAP,  Document wrapped Literal is my preference for interoperability