KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > qnameser > PlanService


1 package test.wsdl.qnameser;
2
3
4
5 import javax.xml.namespace.QName JavaDoc;
6
7
8
9 import java.rmi.RemoteException JavaDoc;
10
11
12
13 public class PlanService {
14
15     
16
17     public static final QName JavaDoc Q_1 = new QName JavaDoc("http://foo", "1");
18
19     public static final QName JavaDoc Q_2 = new QName JavaDoc("http://tempuri.org/", "2");
20
21     public static final QName JavaDoc Q_3 = new QName JavaDoc("", "3");
22
23
24
25     public GetPlanResponse getPlan(QName JavaDoc parameters)
26
27         throws RemoteException JavaDoc {
28
29         String JavaDoc localName = parameters.getLocalPart();
30
31         String JavaDoc namespace = null;
32
33         if (localName.equals(Q_1.getLocalPart())) {
34
35             namespace = Q_1.getNamespaceURI();
36
37         } else if (localName.equals(Q_2.getLocalPart())) {
38
39             namespace = Q_2.getNamespaceURI();
40
41         } else if (localName.equals(Q_3.getLocalPart())) {
42
43             namespace = Q_3.getNamespaceURI();
44
45         } else {
46
47             throw new RemoteException JavaDoc("invalid localname:" + localName);
48
49         }
50
51         
52
53         if (!parameters.getNamespaceURI().equals(namespace)) {
54
55             throw new RemoteException JavaDoc("Expected: " + namespace + " but got: " +
56
57                                       parameters.getNamespaceURI());
58
59         }
60
61
62
63         return new GetPlanResponse();
64
65     }
66
67
68
69     public GetMPlanResponse getMPlan(GetMPlan in)
70
71         throws RemoteException JavaDoc {
72
73         QName JavaDoc [] list = in.getList();
74
75         for (int i=0;i<list.length;i++) {
76
77             getPlan(list[i]);
78
79         }
80
81         return new GetMPlanResponse();
82
83     }
84
85
86
87 }
88
89
Popular Tags