This project has retired. For details please refer to its
Attic page.
HTTPNotifier xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juddi.subscription.notify;
18
19 import java.io.IOException;
20 import java.net.URL;
21 import java.rmi.RemoteException;
22 import java.util.Map;
23
24 import javax.xml.namespace.QName;
25 import javax.xml.ws.BindingProvider;
26 import javax.xml.ws.Service;
27
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30 import org.apache.juddi.api_v3.AccessPointType;
31 import org.apache.juddi.model.BindingTemplate;
32 import org.apache.juddi.v3.client.UDDIService;
33 import org.uddi.api_v3.DispositionReport;
34 import org.uddi.subr_v3.NotifySubscriptionListener;
35 import org.uddi.v3_service.DispositionReportFaultMessage;
36 import org.uddi.v3_service.UDDISubscriptionListenerPortType;
37
38 public class HTTPNotifier implements Notifier {
39
40 private static String SUBR_V3_NAMESPACE = "urn:uddi-org:v3_service";
41 private static String SUBSCRIPTION_LISTENER_SERVICE = "UDDISubscriptionListenerImplPort";
42 Log log = LogFactory.getLog(this.getClass());
43 UDDISubscriptionListenerPortType subscriptionListenerPort = null;
44
45 public HTTPNotifier(BindingTemplate bindingTemplate) throws IOException {
46 super();
47 String accessPointUrl = bindingTemplate.getAccessPointUrl().toLowerCase();
48 if (!accessPointUrl.startsWith("http")) {
49 log.warn("http accessPointUrl for bindingTemplate " + bindingTemplate.getEntityKey()
50 + " should start with 'http' or 'https'");
51 }
52
53 accessPointUrl = bindingTemplate.getAccessPointUrl();
54 if (AccessPointType.WSDL_DEPLOYMENT.toString().equalsIgnoreCase(bindingTemplate.getAccessPointType())) {
55
56
57 QName qName = new QName(SUBR_V3_NAMESPACE, SUBSCRIPTION_LISTENER_SERVICE);
58 Service service = Service.create(new URL(bindingTemplate.getAccessPointUrl()), qName);
59 subscriptionListenerPort = (UDDISubscriptionListenerPortType) service.getPort(UDDISubscriptionListenerPortType.class);
60 } else if (AccessPointType.END_POINT.toString().equalsIgnoreCase(bindingTemplate.getAccessPointType())) {
61
62 UDDIService uddiService = new UDDIService();
63 subscriptionListenerPort = uddiService.getUDDISubscriptionListenerPort();
64 Map<String, Object> requestContext = ((BindingProvider) subscriptionListenerPort).getRequestContext();
65 requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, accessPointUrl);
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 }
82
83 public DispositionReport notifySubscriptionListener(NotifySubscriptionListener body) throws DispositionReportFaultMessage, RemoteException {
84 return subscriptionListenerPort.notifySubscriptionListener(body);
85 }
86 }