很多web Service的教程里面都有这样的例子的
比如jwsdp的tutorial
比如jwsdp的tutorial
解决方案 »
- 关于INTEGER的神奇问题.牛人请进
- Hibernate中的HQL语句求指教了!
- 这个为什么乱码 求解
- 创建SESSION 参数问题
- jsp编码问题
- 关于applet的问题,救命。全部分都给了
- Exception in creating message-driven bean container: [com.sun.enterprise.connectors.ConnectorRuntimeException: JMS resource not
- CMP中relationship 问题
- 请用struts开发过实际项目的朋友进来说说
- Weblogic中如何使Class自动更新?
- SOS!!!Weblogic部署EJB时出现ZipFile Closed错误?????
- JSP 对 EJB 应用的问题?
String RegistryURL = "http://localhost:8080/RegistryServer";
String RPCDistributor = "JAXRPCCoffeeDistributor";
retailPriceItems = new ArrayList();
distributors = new ArrayList(); JAXRQueryByName jq = new JAXRQueryByName();
Connection connection = jq.makeConnection(RegistryURL, RegistryURL);
Collection orgs = jq.executeQuery(RPCDistributor);
Iterator orgIter = orgs.iterator();
// Display organization information
try {
while (orgIter.hasNext()) {
Organization org = (Organization) orgIter.next();
System.out.println("Org name: " + jq.getName(org));
System.out.println("Org description: " + jq.getDescription(org));
System.out.println("Org key id: " + jq.getKey(org)); // Display service and binding information
Collection services = org.getServices();
Iterator svcIter = services.iterator();
while (svcIter.hasNext()) {
Service svc = (Service) svcIter.next();
System.out.println(" Service name: " + jq.getName(svc));
System.out.println(" Service description: " + jq.getDescription(svc));
Collection serviceBindings = svc.getServiceBindings();
Iterator sbIter = serviceBindings.iterator();
while (sbIter.hasNext()) {
ServiceBinding sb = (ServiceBinding) sbIter.next();
String distributor = sb.getAccessURI();
System.out.println(" Binding Description: " + jq.getDescription(sb));
System.out.println(" Access URI: " + distributor); // Get price list from service at distributor URI
PriceListBean priceList = PriceFetcher.getPriceList(distributor);
Collection priceItems = priceList.getPriceItems();
for (Iterator it=priceItems.iterator(); it.hasNext(); ) {
PriceItemBean pib = (PriceItemBean)it.next();
BigDecimal price = pib.getPricePerPound().multiply(new BigDecimal("1.35")).setScale(2, BigDecimal.ROUND_HALF_UP);
RetailPriceItem rpi = new RetailPriceItem(pib.getCoffeeName(), pib.getPricePerPound(), price, distributor);
retailPriceItems.add(rpi);
}
distributors.add(distributor);
}
}
// Print spacer between organizations
System.out.println(" --- ");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// At end, close connection to registry
if (connection != null) {
try {
connection.close();
} catch (JAXRException je) {}
}
}