ReaderClient.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- package bible.webservices.message.producer.client;
- import javax.naming.Context;
- import javax.naming.InitialContext;
- import java.net.URL;
- import java.util.Properties;
- import weblogic.soap.WebServiceProxy;
- import weblogic.soap.SoapMethod;
- import weblogic.soap.SoapType;
- import weblogic.soap.codec.CodecFactory;
- import weblogic.soap.codec.SoapEncodingCodec;
- /**
- * Class ReaderClient
- *
- *
- * @author
- * @version %I%, %G%
- */
- public class ReaderClient {
- /**
- * Constructor ReaderClient
- *
- *
- */
- public ReaderClient() {}
- /**
- * Method main
- *
- *
- * @param args
- *
- */
- public static void main(String[] args) {
- try {
- CodecFactory factory = CodecFactory.newInstance();
- factory.register(new SoapEncodingCodec());
- WebServiceProxy proxy = WebServiceProxy
- .createService(new URL("http://localhost:7001/producerWS/receiveMsg"));
- proxy.setCodecFactory(factory);
- proxy.setVerbose(false);
- SoapType ret = new SoapType("result", String.class);
- proxy.addMethod("receive", ret, null);
- SoapMethod method = proxy.getMethod("receive");
- while (true){
- Object result = method.invoke(null);
- System.out.println("The message returned from "
- + "the web service queue: " + result);
- if (result.equals("Stop")) {
- break;
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- /*--- Formatted in Bible Style on Thu, Sep 6, '01 ---*/
- /*------ Formatted by Jindent 3.24 Gold 1.02 --- http://www.jindent.de ------*/