Source code: customfactory/client/CustomServiceFactoryImpl.java
1 package customfactory.client;
2
3 import org.apache.wsif.WSIFServiceFactory;
4 import org.apache.wsif.WSIFService;
5 import org.apache.wsif.WSIFException;
6 import javax.wsdl.*;
7
8 public class CustomServiceFactoryImpl extends WSIFServiceFactory {
9 public CustomServiceFactoryImpl() {
10 System.out.println("Using custom factory");
11 }
12 /**
13 * Create a WSIFService from WSDL document URL.
14 * <br> If serviceName or serviceNS is null,
15 * then WSDL document must have exactly one service in it.
16 * <br> If portTypeName or portTypeNS is null,
17 * then WSDL document must have exactly one portType in it
18 * and all ports of the selected service must
19 * implement the same portType.
20 * @param wsdlLoc The URL for the wsdl's location
21 * @param serviceNS The namespace of the service
22 * @param serviceName The name of the service
23 * @param portTypeNS The namespace of the port type
24 * @param portTypeName The name of the port type
25 * @return The service
26 * @exception A WSIFException if an error occurs when creating the service
27 */
28 public WSIFService getService(
29 String wsdlLoc,
30 String serviceNS,
31 String serviceName,
32 String portTypeNS,
33 String portTypeName)
34 throws WSIFException {
35 CustomServiceImpl wsi =
36 new CustomServiceImpl(
37 wsdlLoc,
38 serviceNS,
39 serviceName,
40 portTypeNS,
41 portTypeName);
42 return wsi;
43 }
44
45 /**
46 * Create a WSIF service instance from WSDL document URL
47 * using a ClassLoader to find local resources.
48 * <br> If serviceName or serviceNS is null,
49 * then WSDL document must have exactly one service in it.
50 * <br> If portTypeName or portTypeNS is null,
51 * then WSDL document must have exactly one portType in it
52 * and all ports of the selected service must
53 * implement the same portType.
54 * @param wsdlLoc The URL for the wsdl's location
55 * @param cl A ClassLoader to use in locating the wsdl
56 * @param serviceNS The namespace of the service
57 * @param serviceName The name of the service
58 * @param portTypeNS The namespace of the port type
59 * @param portTypeName The name of the port type
60 * @return The service
61 * @exception A WSIFException if an error occurs when creating the service
62 */
63 public WSIFService getService(
64 String wsdlLoc,
65 ClassLoader cl,
66 String serviceNS,
67 String serviceName,
68 String portTypeNS,
69 String portTypeName)
70 throws WSIFException {
71 CustomServiceImpl wsi =
72 new CustomServiceImpl(
73 wsdlLoc,
74 cl,
75 serviceNS,
76 serviceName,
77 portTypeNS,
78 portTypeName);
79 return wsi;
80 }
81
82 /**
83 * Returns a new WSIFService.
84 * @param def The Definition object representing the wsdl
85 * @return The service
86 * @exception A WSIFException if an error occurs when creating the service
87 */
88 public WSIFService getService(Definition def) throws WSIFException {
89 CustomServiceImpl wsi = new CustomServiceImpl(def);
90 return wsi;
91 }
92
93 /**
94 * Returns a new WSIFService.
95 * @param def The Definition object representing the wsdl
96 * @param service The Service object representing the service to use
97 * @return The service
98 * @exception A WSIFException if an error occurs when creating the service
99 */
100 public WSIFService getService(Definition def, Service service)
101 throws WSIFException {
102 CustomServiceImpl wsi = new CustomServiceImpl(def, service);
103 return wsi;
104 }
105
106 /**
107 * Returns a new WSIFService.
108 * @param def The Definition object representing the wsdl
109 * @param service The Service object representing the service to use
110 * @param portType The PortType object representing the port type to use
111 * @return The service
112 * @exception A WSIFException if an error occurs when creating the service
113 */
114 public WSIFService getService(
115 Definition def,
116 Service service,
117 PortType portType)
118 throws WSIFException {
119 CustomServiceImpl wsi = new CustomServiceImpl(def, service, portType);
120 return wsi;
121 }
122
123 /**
124 * Returns a new WSIFService.
125 * @param def The Definition object representing the wsdl
126 * @param serviceNS The namespace of the service
127 * @param serviceName The name of the service
128 * @param portTypeNS The namespace of the port type
129 * @param portTypeName The name of the port type
130 * @return The service
131 * @exception A WSIFException if an error occurs when creating the service
132 */
133 public WSIFService getService(
134 Definition def,
135 String serviceNS,
136 String serviceName,
137 String portTypeNS,
138 String portTypeName)
139 throws WSIFException {
140 CustomServiceImpl wsi =
141 new CustomServiceImpl(
142 def,
143 serviceNS,
144 serviceName,
145 portTypeNS,
146 portTypeName);
147 return wsi;
148 }
149 }