Client.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- package bible.webservices.message.consumer.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 client
- *
- *
- * @author
- * @version %I%, %G%
- */
- public class Client {
- /**
- * Constructor client
- *
- *
- */
- public Client() {}
- /**
- * 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/consumerWS/sendMsg"));
- proxy.setCodecFactory(factory);
- proxy.setVerbose(false);
- SoapType param = new SoapType("message", String.class);
- proxy.addMethod("send", null, new SoapType []{ param });
- SoapMethod method = proxy.getMethod("send");
- String message =
- "Sending data to the JMS queueReader from the client";
- Object result = method.invoke(new Object []{ message });
- } 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 ------*/