package org.jboss.test.webservice.wsdlimport;
import junit.framework.Test;
import org.jboss.test.JBossTestCase;
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import java.net.URL;
public class SchemaImportTestCase extends JBossTestCase
{
private final String WSDL_LOCATION = "http://" + getServerHost() + ":8080/ws4ee-wsdlimport2/HelloPort?wsdl";
private String NAMESPACE = "http://org.jboss.webservice/example";
private final QName SERVICE_NAME = new QName(NAMESPACE, "HelloService");
public SchemaImportTestCase(String name)
{
super(name);
}
public static Test suite() throws Exception
{
return getDeploySetup(SchemaImportTestCase.class, "ws4ee-wsdlimport2.war");
}
public void testHello() throws Exception
{
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service service = serviceFactory.createService(new URL(WSDL_LOCATION), SERVICE_NAME);
Call call = (Call)service.createCall(new QName(NAMESPACE, "HelloServicePort"), "helloString");
String retstr = (String)call.invoke(new Object[]{"Tom"});
assertEquals("Hello Tom!", retstr);
}
}