package oracle.demo.header;
import java.net.URL; import javax.xml.rpc.*; import javax.xml.namespace.QName;
public class CreditCardClient { public static final String DEFAULT_URL = "http://localhost:8888/creditService/creditService";
public static final String NAME = "John";
public static void main(String[] args) throws Exception {
String address = DEFAULT_URL;
if( args != null && args.length > 0 ) { address = args[0]; }
ServiceFactory factory = ServiceFactory.newInstance();
QName portQname = new QName("http://oracle.j2ee.ws/ejb/Credit", "CreditServiceInfPort");
Service service = factory.loadService( new URL( address + "?WSDL" ), CreditServiceEJB.class, null );
CreditServiceInf serviceInf =(CreditServiceInf)service.getPort( portQname,CreditServiceInf.class);
((Stub)serviceInf )._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,address);
System.out.println(serviceInf.getCard(NAME)); } }
|