Package org.objectweb.celtix.bus.bindings.soap

Source Code of org.objectweb.celtix.bus.bindings.soap.SoapBindingFactoryTest

package org.objectweb.celtix.bus.bindings.soap;

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Binding;

import junit.framework.TestCase;

import org.objectweb.celtix.Bus;
import org.objectweb.celtix.bindings.BindingFactory;
import org.objectweb.celtix.bindings.ClientBinding;
import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
import org.objectweb.celtix.wsdl.EndpointReferenceUtils;

public class SoapBindingFactoryTest extends TestCase {

    public SoapBindingFactoryTest(String arg0) {
        super(arg0);
    }

    public static void main(String[] args) {
        junit.textui.TestRunner.run(SoapBindingFactoryTest.class);
    }
   
    public void testCreateClientBinding() throws Exception {
        Bus bus = Bus.init(new String[0]);
        BindingFactory factory =
            bus.getBindingManager().getBindingFactory(
                "http://schemas.xmlsoap.org/wsdl/soap/");
        assertNotNull(factory);
       
        URL url = getClass().getClassLoader().getResource(".");
        URL wsdlUrl = new URL(url, "../classes-tests/wsdl/hello_world.wsdl");
        assertNotNull(wsdlUrl);
        QName serviceName = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService");
        EndpointReferenceType address = EndpointReferenceUtils
            .getEndpointReference(wsdlUrl, serviceName, "SoapPort");
       
        ClientBinding clientBinding = factory.createClientBinding(address);
        assertNotNull(clientBinding);
        assertTrue(SOAPClientBinding.class.isInstance(clientBinding));
       
        SOAPClientBinding soapClientBinding = (SOAPClientBinding)clientBinding;
        Binding b = soapClientBinding.getBinding();
        assertNotNull(b);
        assertTrue(SOAPBindingImpl.class.isInstance(b));
              
        bus.shutdown(true);      
    }
   
}
TOP

Related Classes of org.objectweb.celtix.bus.bindings.soap.SoapBindingFactoryTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.