datatype mappings in Axis to java

K

kalpesh.mahadik

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
 
V

vahan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,096
Latest member
ThurmanCre

Latest Threads

Top