1
2
3
4
5
6
7
8 package it.imolinfo.jbi4ejb.jbi.wsdl;
9
10 import it.imolinfo.jbi4ejb.Logger;
11 import it.imolinfo.jbi4ejb.LoggerFactory;
12
13 import javax.wsdl.Definition;
14 import javax.wsdl.WSDLException;
15 import javax.wsdl.extensions.ExtensibilityElement;
16 import javax.wsdl.extensions.ExtensionRegistry;
17 import javax.wsdl.extensions.ExtensionSerializer;
18 import javax.xml.namespace.QName;
19
20 import com.ibm.wsdl.util.xml.DOMUtils;
21
22
23
24
25
26
27
28
29
30 public class Jbi4EjbAddressSerializer implements ExtensionSerializer {
31
32
33
34
35 private static final Logger LOG
36 = LoggerFactory.getLogger(Jbi4EjbAddressSerializer.class);
37
38
39
40
41 public Jbi4EjbAddressSerializer() {}
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 @SuppressWarnings("unchecked")
60 public void marshall(Class parentType, QName elementType,
61 ExtensibilityElement extension, java.io.PrintWriter pw, Definition def, ExtensionRegistry extReg)
62 throws WSDLException {
63
64
65 String prefix = DOMUtils.getPrefix(Jbi4EjbExtension.NS_URI_JBI4EJB, def);
66 prefix += ":";
67 LOG.debug("prefix found: " + prefix);
68
69
70 if (prefix == null) {
71 prefix = Jbi4EjbExtension.DEFAULT_PREFIX;
72
73 def.addNamespace(Jbi4EjbExtension.DEFAULT_PREFIX, Jbi4EjbExtension.NS_URI_JBI4EJB);
74 }
75
76 if (extension instanceof Jbi4EjbAddress) {
77 Jbi4EjbAddress jbi4EjbAddress = (Jbi4EjbAddress) extension;
78 pw.print("<" + prefix + Jbi4EjbExtension.ADDRESS_ELEMENT);
79 DOMUtils.printAttribute(Jbi4EjbExtension.NAME_ATTRIBUTE,jbi4EjbAddress.getName(), pw);
80 DOMUtils.printAttribute(Jbi4EjbExtension.LOCALIZATION_TYPE_ATTRIBUTE,jbi4EjbAddress.getLocalizationType(), pw);
81 pw.print("/>");
82 } else {
83 LOG.warn("EJB000401_Error_in_extension_element", new Object[]{Jbi4EjbExtension.ADDRESS_ELEMENT});
84 }
85 }
86 }