I want to know about the mappings of datatypes from XSD datatypes to
java datatypes.
Suppose I am calling a web service method using axis and if that
method's return type is xsd:gYear or something that is not supported in
java, what call.invoke() method of axis will return me back?will it
return axis's custom class (org.apache.axis.types.Year) object?
if yes, then in case of xsd:short, which has corresponding datatype
java.lang.Short, what will axis return?
pls provide links to related documents, If possible.
Thanks in advance
Kalpesh
vahan - 29 Aug 2006 10:40 GMT
You need to register your Type Mapping before e.c.:
Class cls = null;
Service service = new Service();
Call call = (Call) service.createCall();
QName qName;
//for java bean
Class beansf = BeanSerializerFactory.class;;
Class beandf = BeanDeserializerFactory.class;
//for simple type
Class simplesf = SimpleSerializerFactory.class;
Class simpledf = SimpleDeserializerFactory.class;
// for java bean
qName = new javax.xml.namespace.QName(
"http://www.w3.org/2001/XMLSchema",
"anyType");
call.registerTypeMapping(cls, qName, beansf, beandf);
//for simple type , you can register int type as java String or
something other
java simple type
qName = new javax.xml.namespace.QName(
"http://www.w3.org/2001/XMLSchema",
"int");
call.registerTypeMapping(String.class, qName, simplesf,
simpledf);
//after that you need to poit your expected return type before
call.invoke
call.setReturnType(new javax.xml.namespace.QName("someURL ",
"MyReturnType"));
// and ivoke call
MyReturnType ret = (MyReturnType) call.invoke(new Object[]
{instanceMySendObject });
You can define you return type yourself
Best Vahan
> I want to know about the mappings of datatypes from XSD datatypes to
> java datatypes.
[quoted text clipped - 11 lines]
> Thanks in advance
> Kalpesh