From: <tho...@jb...> - 2005-05-09 15:56:05
|
Marshalling ------------- For marshalling the WS layer passes to the JAXB layer * optional java object instance * required URL to the packaged or generated XSDSchema * required QName of the root element * optional QName of the root complex type * optional instance of JavaWsdlMapping | jaxbMarshaller.setProperty(MarshallerImpl.JAXB_SCHEMA_LOCATION, xsdURL); | jaxbMarshaller.setProperty(MarshallerImpl.JAXB_TYPE_QNAME, xmlType); | jaxbMarshaller.setProperty(MarshallerImpl.JAXB_ROOT_QNAME, xmlName); | jaxbMarshaller.setProperty(MarshallerImpl.JAXB_JAVA_MAPPING, jaxrpcMapping); | | StringWriter strwr = new StringWriter(); | jaxbMarshaller.marshal(value, strwr); | If the object value is null, the corresponding XML representation of the nillable element should be marshalled. The xmlType is redundant if the xmlName corresponds to a global element definition in schema. If the java mapping is null, default mapping rules apply. The result is a self contained (i.e. contains all namespace definitions) XML document without the XML declaration. In case of an marshalling problem a descriptive exception is thrown. Unmarshalling ---------------- For unmarshalling the WS layer passes to the JAXB layer * required self contained xml content * required URL to the packaged or generated XSDSchema * optional QName of the root complex type * optional instance of JavaWsdlMapping | jaxbUnmarshaller.setProperty(MarshallerImpl.JAXB_SCHEMA_LOCATION, xsdURL); | jaxbUnmarshaller.setProperty(MarshallerImpl.JAXB_TYPE_QNAME, xmlType); | jaxbUnmarshaller.setProperty(MarshallerImpl.JAXB_JAVA_MAPPING, jaxrpcMapping); | | ByteArrayInputStream ins = new ByteArrayInputStream(val.getBytes()); | Object value = jaxbUnmarshaller.unmarshal(ins); | The xmlType is redundant if the root element name corresponds to a global element definition in schema. If the java mapping is null, default mapping rules apply. The result is an object instance or null. In case of an unmarshalling problem a descriptive exception is thrown. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3877034#3877034 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3877034 |