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 "Sampige, Srinivas" <SS...@DIRECTV.com> on 2007/03/12 23:41:39 UTC
java object serialization in AXIS1 ..
I am serializing an object (which was generated as part of the client
classes) using the following code -
public static String getXML(ScheduleMessage message)
{
try
{
javax.xml.namespace.QName qName = new
javax.xml.namespace.QName("http://tempuri.org/", "ScheduleMessage");
BeanSerializer beanSerializer = new
org.apache.axis.encoding.ser.BeanSerializer(com.directv.dtss.itx.client.
ScheduleMessage.class, qName, typeDesc);
StringWriter w = new StringWriter();
SerializationContext ctx = new SerializationContext(w);
beanSerializer.serialize(qName, null, message, ctx);
StringBuffer b = w.getBuffer();
System.out.print(b.toString());
return b.toString();
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
Question - In the generated type below how do I get rid of the xsi:type
and xmlns:xsi when the XML gets generated? I want the XML to be clean
..something like <StartDate>2007-03-12T21:49:04.351Z</StartDate> ...etc.
instead of what is generated currently -
<?xml version="1.0" encoding="UTF-8"?><ns1:ScheduleMessage
xmlns:ns1="http://tempuri.org/"><Events xsi:type="ns1:ScheduleEvent"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><EventId
xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">eventid</EventId><StartDate
xsi:type="xsd:dateTime"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">2007-03-12T21:49:04.351Z</S
tartDate><StartTime xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">10:00:00</StartTime><StartM
ode xsi:type="ns1:EventStartType">Manual</StartMode><Source
xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">source</Source>
Any help is greatly appreciated.
Regards
Srinivas
RE: java object serialization in AXIS1 ..
Posted by "Sampige, Srinivas" <SS...@DIRECTV.com>.
Anybody got any ideas for this...?....
________________________________
From: Sampige, Srinivas [mailto:SSampige@DIRECTV.com]
Sent: Monday, March 12, 2007 3:42 PM
To: axis-user@ws.apache.org
Subject: java object serialization in AXIS1 ..
I am serializing an object (which was generated as part of the client
classes) using the following code -
public static String getXML(ScheduleMessage message)
{
try
{
javax.xml.namespace.QName qName = new
javax.xml.namespace.QName("http://tempuri.org/", "ScheduleMessage");
BeanSerializer beanSerializer = new
org.apache.axis.encoding.ser.BeanSerializer(com.directv.dtss.itx.client.
ScheduleMessage.class, qName, typeDesc);
StringWriter w = new StringWriter();
SerializationContext ctx = new SerializationContext(w);
beanSerializer.serialize(qName, null, message, ctx);
StringBuffer b = w.getBuffer();
System.out.print(b.toString());
return b.toString();
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
Question - In the generated type below how do I get rid of the xsi:type
and xmlns:xsi when the XML gets generated? I want the XML to be clean
..something like <StartDate>2007-03-12T21:49:04.351Z</StartDate> ...etc.
instead of what is generated currently -
<?xml version="1.0" encoding="UTF-8"?><ns1:ScheduleMessage
xmlns:ns1="http://tempuri.org/"><Events xsi:type="ns1:ScheduleEvent"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><EventId
xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">eventid</EventId><StartDate
xsi:type="xsd:dateTime"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">2007-03-12T21:49:04.351Z</S
tartDate><StartTime xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">10:00:00</StartTime><StartM
ode xsi:type="ns1:EventStartType">Manual</StartMode><Source
xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">source</Source>
Any help is greatly appreciated.
Regards
Srinivas