01: package org.objectweb.celtix.bus.jaxws.io;
02:
03: import javax.xml.namespace.QName;
04: import javax.xml.soap.SOAPException;
05: import javax.xml.soap.SOAPMessage;
06: import javax.xml.transform.dom.DOMSource;
07: import javax.xml.transform.sax.SAXSource;
08: import javax.xml.transform.stream.StreamSource;
09:
10: import org.objectweb.celtix.bindings.DataWriter;
11: import org.objectweb.celtix.bus.jaxws.DynamicDataBindingCallback;
12: import org.objectweb.celtix.context.ObjectMessageContext;
13:
14: public class SOAPMessageDataWriter<T> implements DataWriter<T> {
15:
16: protected SOAPMessage dest;
17: final DynamicDataBindingCallback callback;
18:
19: public SOAPMessageDataWriter(DynamicDataBindingCallback cb) {
20: callback = cb;
21: }
22:
23: public void write(Object obj, T output) {
24: dest = (SOAPMessage) output;
25: try {
26: if (DOMSource.class.isAssignableFrom(obj.getClass())) {
27: DOMSource src = (DOMSource) obj;
28: dest.getSOAPPart().setContent(src);
29: } else if (SAXSource.class.isAssignableFrom(obj.getClass())) {
30: SAXSource src = (SAXSource) obj;
31: dest.getSOAPPart().setContent(src);
32: } else if (StreamSource.class.isAssignableFrom(obj
33: .getClass())) {
34: StreamSource src = (StreamSource) obj;
35: dest.getSOAPPart().setContent(src);
36: }
37: } catch (SOAPException se) {
38: //TODO
39: }
40: }
41:
42: public void write(Object obj, QName elName, T output) {
43: //Complete
44: }
45:
46: public void writeWrapper(ObjectMessageContext objCtx,
47: boolean isOutbound, T output) {
48: //Complete
49: }
50:
51: }
|