Java 客户端调用HttS Webservice....

出自本人之手 专栏收录该内容
3 篇文章 0 订阅

Java 客户端调用HttS Webservice....

Java 要调用远程Https webservice 必需具用远程服务器提供的客户端信任书及密钥...

将client.keystore和client.truststore拷贝到classes/test目录下.

 package test;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
   public class TestEcVoteNotice
   {
      public static void main(String [] args) throws Exception {
       System.setProperty("javax.net.ssl.keyStore", "test//client.keystore");
        System.setProperty("javax.net.ssl.keyStorePassword", "abc");
        System.setProperty("javax.net.ssl.trustStore", "test//client.truststore");
        System.setProperty("javax.net.ssl.trustStorePassword", "abc");
        //System.setProperty("javax.net.debug", "ssl");
        //System.setProperty("https.protocols", "TLSv1");
        //System.setProperty("java.protocol.handler.pkgs","javax.net.ssl");


      String endpoint = "https://localhost:" +"8443"+ "/axis/services/EcVoteNotice";
      //String endpoint = "http://localhost:" +"8080"+ "/axis/services/EcVoteNotice";
          Service  service = new Service();
          Call     call    = (Call) service.createCall();
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
        call.setOperationName("toStringP");
        String res = (String) call.invoke( new Object[] {"Box"} );
        call.setOperationName("toString");
        String res2 = (String) call.invoke( new Object[] {} );
       
        System.out.println( res+"/"+res2 );
      }
   }

在classes目录下执行...

java -cp %AXISCLASSPATH% test.TestEcVoteNotice 

OK.

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

Azzet 是一个简单的 Java 类库,用于从不同的源中加载资源。示例代码:BufferedImage img = Assets.load("http://www.google.com/logos/classicplus.png"); // loaded from website Font fnt = Assets.load("myfont.ttf", new FontInfo(32.0f)); // loaded from classpath Clip snd = Assets.load("C:\UserData\MyMusic.wav"); // loaded from file-system BufferedImage gif = Assets.loadFrom("mygif.gif", BufferedImage.class); // you can request the return type BufferedImage[] animatedGif = Assets.loadFrom("mygif.gif", "db"); // loads from DatabaseSource saved as "db" Properties props = Assets.loadFrom("app.properties", "tcp"); // loads from TcpSource saved as "tcp"支持的格式包括:JSON (org.magnos.asset.json.JsonValue)XML (org.w3c.dom.Document)PROPERTIES/XML/CONFIG (java.util.Properties, org.magnos.asset.props.Config)GIF (java.awt.image.BufferedImage[])PNG/BMP/WBMP/JPEG/JPG (java.awt.image.BufferedImage)MID/MIDI (javax.sound.midi.Sequence)WAV/AU/AIFF/SND (javax.sound.sampled.Clip)TTF (java.awt.Font)CSV (org.magnos.asset.csv.Table)CLASS/CLAZZ (java.lang.Class)JAR (org.magnos.asset.java.Jar)ZIP (org.magnos.asset.zip.Zip)GZ (org.magnos.asset.AssetInfo)DAT (byte[], java.io.InputStream, java.nio.ByteBuffer, java.io.ByteArrayOutputStream)TXT (java.lang.String, char[], java.nio.CharBuffer, java.lang.StringBuffer, java.lang.StringBuilder)支持的数据源:ClasspathFile-SystemDatabaseJARFTPHTTP/HTTPSUDPTCPSSLUDP Multicast示例代码:FutureAssetBundle bundle = new FutureAssetBundle(); bundle.add( Assets.loadFuture("image.gif", BufferedImage.class) ); bundle.add( Assets.loadFuture("sound.wav", Clip.class) ); BufferedImage image = null; Clip sound = null; // game loop while (running) {    // do stuff    // this occurs during the loading screen....    if (bundle.isComplete()) {        bundle.loaded(); // notify all FutureAsset implementations the asset has been accepted.        image = bundle.getAsset("image.gif");        sound = bundle.getAsset("sound.wav");        // move from loading to play screen    } else {        display bundle.percentComplete();         }    // do other stuff } 标签:Azzet
©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值