/**
* Created : Anirban
* Date: May 19, 2003
* Modified by : Chandar
*
* File : CreditCardClient.java
*
* Overview :
* This file defines the client for the Credit Card Web Service
*/ package oracle.demo.header;
import java.net.URL;
import javax.xml.rpc.*;
import javax.xml.namespace.QName;
public class CreditCardClient
{
// variable for Web Service URL
public static final String DEFAULT_URL = "http://localhost:8888/creditService/creditService";
public static final String NAME = "John";
/*
* Definition of main class of the client
*/ public static void main(String[] args) throws Exception {
String address = DEFAULT_URL;
// get the Web Service URL from runtime arguments
if( args != null && args.length > 0 ) {
address = args[0];
}
// create new instance of service factory
ServiceFactory factory = ServiceFactory.newInstance();
// define QName for Credit Card Service
QName portQname = new QName("http://oracle.j2ee.ws/ejb/Credit",
"CreditServiceInfPort");
//Load ejb WebSerivce client-side proxy(stub).
Service service = factory.loadService( new URL( address + "?WSDL" ),
CreditServiceEJB.class, null );
// get the stub for Web Service
CreditServiceInf serviceInf =(CreditServiceInf)service.getPort(
portQname,CreditServiceInf.class);
// set the service endpoint URL on stub
((Stub)serviceInf )._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,address);
// invoke web service method
System.out.println(serviceInf.getCard(NAME));
}
}

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy