Hello KSoap Users,
I just started using the kSoap engine as a Web Services Server, the client
being Excel and the MS SOAP Toolkit 3.0.
I had problems passing int parameters from Excel to the kSoap server. Every
time I had an invocation target exception because the types where incorrect.
Indeed the types and args parameters of the SoapReq where not of type
(Class)int but rather AnyType or something like it.
I discovered what might be the cause of the problem, down inside the
ClassMap. When we parse the SOAP request, we look for the for the name of
the method we want to call. With the next argument, and from the classMap
parameters, we deduct the type of the argument that needs to be following
that. However the type is something like (Class)int, but the mapping in the
classToQName hashMap is on java.lang.Integer. not int !
I had to modify the classMap::addMapping function to have the following :
/** Defines a direct mapping from a namespace and name to a java
class (and vice versa), using the given marshal mechanism */
public void addMapping (String namespace, String name,
Class clazz, Marshal marshal) {
qNameToClass.put (new SoapPrimitive (namespace, name, null),
marshal == null ? (Object) clazz : marshal);
classToQName.put (clazz.getName (),
new Object [] {namespace, name, null, marshal});
classToQName.put (name,
new Object [] {namespace, name, null, marshal});
if (prefixMap.getPrefix (namespace) == null)
prefixMap = new PrefixMap (prefixMap, "n"+(cnt++), namespace);
}
Does this sounds familiar to you guys . Or did I make some mistake somewhere
when invoking my web service server ?
Thanks a lot for the help,
Simon
|