You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Simon Jaffer <Si...@peramon.com> on 2002/04/25 17:23:49 UTC

Woes using named parameters to invoke() with wsdl initialisation

Hello

I'm trying to write a web services client using axis, where the Service
object is instantiated from wsdl.

I'm having trouble specifying named parameters for the remote service; it
seems that regardless of the name that I use for each, the parameters still
arrive in the order in which they appear in the object array.

The example code I've been using is shown below.  The remote method simply
returns a String which is the concatenation of its two parameters p1 and p2.
However running the example below indicates that when the remote method is
called, p1 has the value "second" and p2 has the value "first".

I'm making the assumption that the parameter names have been initialised
from the wsdl, hence there are no calls to addParameter - should there be?

As you can probably tell from the code, the remote service is running under
axis on the local host, and I'm fetching the wsdl directly from the server,
so it's not an interoperability issue.  I'm using Beta 1.

I've tried to trawl through the list to find the answer but not found it,
sorry if it's been covered before and I've missed it, but any help would be
appreciated.

Simon

----------------------
   QName serviceQN = new QName("http://localhost:8080/axis/TestService.jws",
        "TestServiceService");
   QName portQN = new QName("http://localhost:8080/axis/TestService.jws",
        "TestService");

   Service s = new Service ( new URL
        ("http://localhost:8080/axis/TestService.jws?wsdl"), serviceQN);

   Call c = (Call) s.createCall( portQN, "test");

   Object [] oa = new Object [] {
            new RPCParam ("p2", "second"),
            new RPCParam ("p1", "first") };

   String result = (String) c.invoke ("test", oa );

   System.out.println (result);
----------------------