readerclient.java
来自「100多M的J2EE培训内容」· Java 代码 · 共 81 行
JAVA
81 行
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 ------*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?