1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.juddi.v3.client.mapping;
19
20 import java.io.StringWriter;
21
22 import javax.jws.WebService;
23 import javax.xml.bind.JAXBContext;
24 import javax.xml.bind.Marshaller;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28 import org.apache.juddi.v3.client.subscription.SubscriptionCallbackListener;
29 import org.uddi.api_v3.DispositionReport;
30 import org.uddi.api_v3.Result;
31 import org.uddi.subr_v3.NotifySubscriptionListener;
32 import org.uddi.v3_service.DispositionReportFaultMessage;
33 import org.uddi.v3_service.UDDISubscriptionListenerPortType;
34
35
36
37
38
39
40
41
42
43
44 @WebService(serviceName="UDDIClientSubscriptionListenerService",
45 endpointInterface="org.uddi.v3_service.UDDISubscriptionListenerPortType",
46 targetNamespace = "urn:uddi-org:v3_service")
47
48 public class UDDIClientSubscriptionListenerImpl implements UDDISubscriptionListenerPortType {
49
50 private static final Log logger = LogFactory.getLog(UDDIClientSubscriptionListenerImpl.class);
51 private UDDIServiceCache serviceCache = null;
52
53 public UDDIClientSubscriptionListenerImpl() {
54 super();
55 }
56
57 public UDDIClientSubscriptionListenerImpl(String bindingKey, UDDIServiceCache serviceCache) {
58 super();
59 this.serviceCache = serviceCache;
60 }
61
62
63
64
65
66
67
68
69
70 public DispositionReport notifySubscriptionListener(
71 NotifySubscriptionListener body)
72 throws DispositionReportFaultMessage
73 {
74 try {
75 JAXBContext context = JAXBContext.newInstance(body.getClass());
76 Marshaller marshaller = context.createMarshaller();
77 StringWriter sw = new StringWriter();
78 marshaller.marshal(body, sw);
79 logger.info("Notification received by UDDISubscriptionListenerService : " + sw.toString());
80
81
82 if (serviceCache!=null) serviceCache.removeAll();
83
84 } catch (Exception e) {
85 logger.error(e.getMessage(),e);
86 }
87
88 DispositionReport dr = new DispositionReport();
89 Result res = new Result();
90 dr.getResult().add(res);
91 return dr;
92 }
93
94 }