KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > dynamic > ServiceGetPort


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package test.dynamic;
17
18 import junit.framework.TestCase;
19 import samples.addr.AddressBook;
20 import samples.addr.AddressBookSOAPBindingStub;
21
22 import javax.xml.namespace.QName JavaDoc;
23 import javax.xml.rpc.Service JavaDoc;
24 import javax.xml.rpc.ServiceFactory JavaDoc;
25 import java.net.URL JavaDoc;
26 import java.rmi.Remote JavaDoc;
27
28 /**
29  * This class tests Fault deserialization.
30  *
31  * @author Sam Ruby (rubys@us.ibm.com)
32  */

33
34 public class ServiceGetPort extends TestCase {
35     
36     public ServiceGetPort(String JavaDoc name) {
37         super(name);
38     } // ctor
39

40     public void testGetGeneratedStub() throws Exception JavaDoc {
41         Service JavaDoc service = ServiceFactory.newInstance().createService(
42                 new URL JavaDoc("file:samples/addr/AddressBook.wsdl"),
43                 new QName JavaDoc("urn:AddressFetcher2", "AddressBookService"));
44         QName JavaDoc portName = new QName JavaDoc("urn:AddressFetcher2", "AddressBook");
45         Remote JavaDoc stub = service.getPort(portName, AddressBook.class);
46         assertTrue("Stub should be an instance of AddressBookSOAPBindingStub; instead, it is " + stub.getClass().getName(), stub instanceof AddressBookSOAPBindingStub);
47     } // testGetGeneratedStub
48
}
49
Popular Tags