From: babloosony <bab...@gm...> - 2005-02-26 14:54:08
|
Hi All, I have below classes and I am trying to return Forecast class object as a return type of a web service method that is exposed using AXIS 1.2 RC2 and JiBX : Temperature.java ------------------------------------------------------------------------------- import java.io.*; public class Temperature implements Serializable { String temp = "35"; public Temperature() {} public void setTemp(String temp) { this.temp = temp; } public String getTemp() { return temp; } } ------------------------------------------------------------------------------- Forecast.java ------------------------------------------------------------------------------- import java.io.*; public class Temperature implements Serializable { String temp = "35"; public Temperature() {} public void setTemp(String temp) { this.temp = temp; } public String getTemp() { return temp; } } ------------------------------------------------------------------------------- I am using JiBX to write a JiBX Serializer for AXIS 1.2 RC2 like below : public class JibxSerializer implements Serializer { .... public JibxSerializer(Class clas, QName qname, IMarshallingContext mctx) { ... } public void serialize(QName name, Attributes attrs, Object value, SerializationContext sctx) throws IOException { ... try { IBindingFactory ifact = BindingDirectory.getFactory(value.getClass()); IMarshallingContext mctx = ifact.createMarshallingContext(); mctx.setOutput(swriter); ((IMarshallable)value).marshal(mctx); mctx.endDocument(); sctx.writeString(swriter.toString()); } catch (JiBXException e) { swriter.close(); throw new IOException("error in JiBX serialization: " + e.getMessage()); } } public String getMechanismType() { ... } public Element writeSchema(Class javaType, Types types) throws Exception { ... } } Now my problem is, at this line "((IMarshallable)value).marshal(mctx)" in JibxSerializer's serializer() method of above code, I am getting an JiBXException and a fatal error saying "The following exception was logged org.jibx.runtime.JiBXException: Collection item of type java.lang.String has no binding defined" at JiBX_MungeAdapter.JiBX_SparePartPriceSession_binding_marshal_1_0() at Forecast.JiBX_SparePartPriceSession_binding_marshal_1_0(Forecast.java) at JiBX_SparePartPriceSession_bindingForecast_access.marshal() at Forecast.marshal(Forecast.java) The resulting string that is to be written to output is below : <forecast xmlns="http://ws.gle.com/schemas/axis/appb" hi="0" low="0" precip="0"><zip>343434</zip><city>Campbell</city><state>CA</state><date>April 11, 2003</date><forecast>20 percent chance of rain.</forecast><temp><temp>35</temp></temp> All the usual configuration of registering all my custom types with TypeMapping element and JiBX (De)Serializers has been done in my AXIS's server-config.wsdd. Can anyone please tell me what am I missing here and why is this error occurring in my server side application server log files. Thanks & Regards, Kumar. |