Have you looked at the Service constructors that take a WSDL? This might be the best route for you, rather than using WSDL2Java. You can build a client very simply. For example (with a service operation that returns a list of types):
...
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
...
...
Service service = null;
String nameSpace = "urn:myService";
String typesNameSpace = "urn:myTypes";
try {
service = new Service("C:/webservices/myService.wsdl", new QName(nameSpace, "myService"));
Call call = (Call)service.createCall(new QName(nameSpace, "myServicePort"), new QName(nameSpace, "myOperation"));
call.registerTypeMapping(MyList.class, new QName(typesNameSpace, "myList"), BeanSerializerFactory.class, BeanDeserializerFactory.class);
call.registerTypeMapping(MyType.class, new QName(typesNameSpace, "myType"), BeanSerializerFactory.class, BeanDeserializerFactory.class);
Object returnObject = call.invoke(new Object[] {null});
System.out.println(returnObject);
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
Tony
"Michael Schuerig" <[EMAIL PROTECTED]> wrote on 06/12/2004 21:30:29:
>
> I want wsdl2java to generate code that interoperates nicely with code
> that already exists in my application. Thus, I don't want it to
> generate specific classes, but rather bind to my existing ones,
> possibly using custom deserializers.
>
> I can achieve this goal partly by these steps
> - types are defined in their own namespace in the WSDL document (or
> external schema document)
> - let wsdl2java (using --nsExclude/--nsInclude) generates code only for
> some namespaces, in particular excluding those which contain types for
> classes my handwritten classes
> - let wsdl2java map these excluded namespaces to the packages of my
> handwritten classes
>
> There are several points, though, where the generated code still doesn't
> fit
> - mapping namespaces to packages is too coarse-grained. I'd need to map
> qualified XML types to qualified class names
> - the generated stub still tries to install de/serializers for all types
> that are used in the WSDL, even if no classes are generated for them.
> I'd need a way to specifiy which type mappings are to be installed and
> which custom de/serializers to be used, if any
>
> Manually adapting the generated code isn't too much work, but it goes
> against my aesthetic sensibilities. The same effect could probably be
> achieved with custom JavaGenerator subclasses. I fear, though, that it
> might be a lot of work, as it's not just an addition but a change to
> existing functionality. Has anyone tried anything like this?
>
> Michael
>
> --
> Michael Schuerig Nothing is as brilliantly adaptive
> mailto:[EMAIL PROTECTED] as selective stupidity.
> http://www.schuerig.de/michael/ --A.O. Rorty, The Deceptive Self
>
- wsdl2java: Tweaking what's generated Michael Schuerig
- Re: wsdl2java: Tweaking what's generated tony . q . weddle
- Re: wsdl2java: Tweaking what's generated Michael Schuerig
- Service(wsdlLoc) and header params (was: ws... Michael Schuerig