1 package org.objectweb.celtix.bus.bindings.soap; 2 3 import java.net.URL ; 4 5 import javax.xml.namespace.QName ; 6 import javax.xml.ws.Binding; 7 8 import junit.framework.TestCase; 9 10 import org.objectweb.celtix.Bus; 11 import org.objectweb.celtix.bindings.BindingFactory; 12 import org.objectweb.celtix.bindings.ClientBinding; 13 import org.objectweb.celtix.ws.addressing.EndpointReferenceType; 14 import org.objectweb.celtix.wsdl.EndpointReferenceUtils; 15 16 public class SoapBindingFactoryTest extends TestCase { 17 18 public SoapBindingFactoryTest(String arg0) { 19 super(arg0); 20 } 21 22 public static void main(String [] args) { 23 junit.textui.TestRunner.run(SoapBindingFactoryTest.class); 24 } 25 26 public void testCreateClientBinding() throws Exception { 27 Bus bus = Bus.init(new String [0]); 28 BindingFactory factory = 29 bus.getBindingManager().getBindingFactory( 30 "http://schemas.xmlsoap.org/wsdl/soap/"); 31 assertNotNull(factory); 32 33 URL url = getClass().getClassLoader().getResource("."); 34 URL wsdlUrl = new URL (url, "../classes-tests/wsdl/hello_world.wsdl"); 35 assertNotNull(wsdlUrl); 36 QName serviceName = new QName ("http://objectweb.org/hello_world_soap_http", "SOAPService"); 37 EndpointReferenceType address = EndpointReferenceUtils 38 .getEndpointReference(wsdlUrl, serviceName, "SoapPort"); 39 40 ClientBinding clientBinding = factory.createClientBinding(address); 41 assertNotNull(clientBinding); 42 assertTrue(SOAPClientBinding.class.isInstance(clientBinding)); 43 44 SOAPClientBinding soapClientBinding = (SOAPClientBinding)clientBinding; 45 Binding b = soapClientBinding.getBinding(); 46 assertNotNull(b); 47 assertTrue(SOAPBindingImpl.class.isInstance(b)); 48 49 bus.shutdown(true); 50 } 51 52 } 53 | Popular Tags |