| 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; |
| 23 |
import javax.xml.rpc.Service; |
| 24 |
import javax.xml.rpc.ServiceFactory; |
| 25 |
import java.net.URL; |
| 26 |
import java.rmi.Remote; |
| 27 |
|
| 28 |
/** |
| 29 |
* This class tests Fault deserialization. |
| 30 |
* |
| 31 |
* @author Sam Ruby ([email protected]) |
| 32 |
*/ |
| 33 |
|
| 34 |
public class ServiceGetPort extends TestCase { |
| 35 |
|
| 36 |
public ServiceGetPort(String name) { |
| 37 |
super(name); |
| 38 |
} // ctor |
| 39 |
|
| 40 |
public void testGetGeneratedStub() throws Exception { |
| 41 |
Service service = ServiceFactory.newInstance().createService( |
| 42 |
new URL("file:samples/addr/AddressBook.wsdl"), |
| 43 |
new QName("urn:AddressFetcher2", "AddressBookService")); |
| 44 |
QName portName = new QName("urn:AddressFetcher2", "AddressBook"); |
| 45 |
Remote 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 |
} |