使用 Axis2主要API开发WebService客户端

基于Axis服务端的webservice客户端实现 基于Axis1服务端的客户端实现;基于Axis2服务端的客户端实现 阅读详情

该部分将为高级用户介绍复杂但是更加强大的基于XML的WebService客户端,然而如果你是一个新手还是建议你使用axis的代码生成器进行客户端的开发.

Web services能够用于为用户提供广泛的功能从单一的功能到像获取证券报价这样的实时操作以及耗时的商业服务.当我们利用这些服务的时候我们单一的客户 端操作方式将不会适合所有的复杂的服务操作 . 例如:我们使用单个传输通道(比如HTTP协议)来执行一个IN-OUT(有输入也有输出)类型并且需要很多时间执行的web service的时候,我们经常会受到"connection time outs"(连接超时). 更多的, 我们的一个客户端需要同时处理多个服务执行请求,如果我们使用"blocking"(阻塞方式)方式的客户端API将会客户端应用程序的性能. 同样的, there are various other consequences such as One-Way transports that come into play when we need them. 让我们来分析一下通常的服务范例.

很多的WebService引擎给用户提供了阻塞(Blocking)和非阻塞(Non-Blocking)的客户端API.

  • Blocking API 阻塞式API- 一旦服务请求发送后,客户端应用程序将阻塞,只有在客户端收到响应或者错误信息程序才会恢复运行,这是执行Web Service最简单的方式,在很多情况下它也适合业务.

  • Non-Blocking API 非阻塞式API- 这是一个基于回调函数或者池技术的API. 一旦一个服务请求发出后客户端将立即恢复运行不会阻塞,服务的响应将会由回调函数来处理. 这将允许客户端同时执行多个Web Service请求而不需要等待前一个请求的响应.

以上的机制都是工作在API层次的. 我们把这种使用在非阻塞API上的异步行为叫做API层异步.

以上的机制都使用单一的连接去发送请求和接收响应.这都明显在性能上落后于使用两条连接(单向或双向)进行进行请求和响应的传输 . 因此以上的机制都不能解决长时间运行的交易, 连接将在操作还没完成就会超时. 一种解决方案是使用分开的两条传输连接来传输请求和响应 . 我们叫这种方案为 传输层异步.

通过API层异步和传输层异步, 我们能获得下表中四种不同的Web Service调用模式.

API (Blocking/Non-Blocking)

双路传输 (Yes/No)

描述

阻塞

No

最简单和熟悉的调用模式

非阻塞

No

使用回调函数或池

阻塞

Yes

这在服务操作是一般的请求响应而传输方式使用单向方式(例如. SMTP协议)

非阻塞

Yes

获得最多的异步行为,在API层和传输层同时实现异步

Axis2 为用户提供以上方式来调用Web services.

以下部分将用ServiceClient实现以上的多种调用模式来调用一个Web Service. 所有代码都保持在 "samples\userguide\src" 目录.

这部分提供四种的客户端.

  1. 发送请求返回响应并且阻塞的客户端
  2. 单向传输,非阻塞的客户端
  3. 发送请求返回响应,非阻塞,使用一条连接传输
  4. 发送请求返回响应,非阻塞,使用二条连接传输
发送请求返回响应并且阻塞的客户端

以下代码执行MyService服务的echo操作使用阻塞和单通道调用.

   try {
                  
      OMElement payload = ClientUtil.getEchoOMElement();
      Options options = new Options();
      options.setTo(targetEPR); // this sets the location of MyService service
            
      ServiceClient serviceClient = new ServiceClient();
      serviceClient.setOptions(options);

      OMElement result = serviceClient.sendReceive(payload);
      
      System.out.println(result);
   } catch (AxisFault axisFault) {
      axisFault.printStackTrace();
   } 
}

绿色高亮代码是对服务的调用.

测试客户端, 使用 "Axis2_HOME/samples/userguide" 目录下的ant脚步. 运行"run.client.blocking"任务.如果看见打印出来的的响应包就是正常的.

单向传输,非阻塞的客户端

调用 "MyService"种的只有输入的 操作"ping" (查看 创建Web Service服务). 以下是代码:

   try {
      OMElement payload = ClientUtil.getPingOMElement();
      Options options = new Options();
      options.setTo(targetEPR);
      ServiceClient serviceClient = new ServiceClient();
      serviceClient.setOptions(options);
      serviceClient.fireAndForget(payload);
      /**
       * We need to wait some time for the message to be sent.  Otherwise,
       * if we immediately exit this function using the main thread, 
       * the request won't be sent.
       */
      Thread.sleep(500);
   } catch (AxisFault axisFault) {
      axisFault.printStackTrace();
   }

我们调用一个只有输入的调用 ,在客户端使用 fireAndForget()调用这个服务. 这样将不会阻塞而会立即返回 测试运行 "run.client.ping" 任务 ,Axis2Home/samples/userguide".

发送请求返回响应,非阻塞,使用一条连接传输

在 "EchoBlockingClient"中一旦serviceClient.sendReceive(payload)被调用, 客户阻塞直道操作完成. 这样的情况在一个客户应用或者GUI中调用多个WebService时将会不令人满意.一种解决方法是使用非阻塞API来调用Web Service. Axis2 提供给用户一个基于回调函数的API.

一个简单的客户端EchoNonBlockingClient保存在 "Axis2_HOME/samples/userguide/src/userguide/clients".

serviceClient.sendReceiveNonblocking(payload, callback);

这个调用接受一个 回调 对象作为参数, Axis2 客户端API提供一个抽象的回调类它有以下方法:

public abstract void onComplete(AsyncResult result);
public abstract void onError(Exception e);
public boolean isComplete() {}

开发人员需要在子类覆盖 onComplete() 和 onError() 方法. Axis2引擎在WebService响应被接收后就执行onComplete()方法. 这样就WebService调用就不会阻塞.

发送请求返回响应,非阻塞,使用二条连接传输

这个解决方案在调用Web Service时候使用前面的非阻塞API有一个限制.这个限制是因为使用一个连接调用Web Service和接收响应. 换句话说, 客户端API为开发者提供非阻塞机制,但是像HTTP这样的双向传输方式任然会在同一连接上传输请求和相应 . 长时间运行的Web Service 或者使用单向传输的例如SMTP协议不能简单的使用非阻塞API.

最简单的解决方案是使用分离的传输连接 (单向或者双向) 传输请求和响应. 接下来需要解决另外一个问题, 然而, 随后是如何将请求和响应进行关联. WS-Addressing 提供一个很好的方法是利用 <wsa:MessageID>和 <wsa:RelatesTo> 头. Axis2提供在两条传输线路上客户端API上基于地址的关联机制. (TAxis2和姓不依赖于 WS-Addressing, 但是包含一组参数, like in addressing, that can be populated by any method. WS-Addressing is one of the uses that may populate them. Even the transports can populate them. Hence, Axis2 has the flexibility to use different addressing standards.)

用户能在两条线路中通过设置标志 阻塞 和非阻塞 API 间选择进行选择, 同样的API可以使用2条不同的传输连接去执行WebService. . 超级异步!! (PS:貌似不很超级)

try {
      OMElement payload = ClientUtil.getEchoOMElement();

      Options options = new Options();
      options.setTo(targetEPR);
      options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
      options.setUseSeparateListener(true);
      options.setAction("urn:echo");  // this is the action mapping we put within the service.xml

      //Callback to handle the response
      Callback callback = new Callback() {
         public void onComplete(AsyncResult result) {
            System.out.println(result.getResponseEnvelope());
         }

         public void onError(Exception e) {
            e.printStackTrace();
         }
      };

      //Non-Blocking Invocation            
      sender = new ServiceClient();            
      sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
      sender.setOptions(options);            
      sender.sendReceiveNonBlocking(payload, callback);            
   
      //Wait till the callback receives the response.            
      while (!callback.isComplete()) {                
         Thread.sleep(1000);            
      }               
   } catch (AxisFault axisFault) {            
     axisFault.printStackTrace();
   } catch (Exception ex) {
     ex.printStackTrace();
   } finally {
      try {
         //Close the Client Side Listener.
         sender.cleanup();
      } catch (AxisFault axisFault) {
        //have to ignore this
      }
   }

ptions.setUseSeparateListener(true)方法告知Axis2 引擎使用2条独立的连接分别传输请求和响应. 最好 sender.cleanup() 告知 Axis2 引擎停止客户端监听, 开始接收响应.


SpringBoot集成Axis2,部署webservice接口并调用 SpringBoot集成Axis2,部署webservice接口并调用一、省略新建springboot项目过程1、pom.xml2、application.yml3、准备工作做完,编写service4、下面在springboot中配置axis25、 以上配置成功后,启动SpringbootApplicationwebservice接口部署成功二、下面进行webservice的调用**webservice接口的调用这里分为两种方式:RPC和客户端**1、使用RPC方式调用,简单方便2、客户端方式调用webse 阅读详情

相关推荐

axis2 webservice jar包使用情况

今天使用axis2webservice,整理了下jar包,方便以后时候。 axis2 webservice 服务端jar包:                               -->axis2-kernel-1.6.1.jar                               -->axis2-spring-1.6.1.jar

elevenaa的专栏 4053

使用Axis2的底层API开发Web Service Server端

1.使用Axis2的底层API开发Web Service Server端   1.1创建一个WebService(取名为MyService)   在MyService中有两个operations,如下所示。   public void ping(OMElement element){}//IN-ONLY模式。仅仅接收OMElement,并对其处理。   public OMElement e

competerH_programing的专栏 1085

WebService Axis客户端调用必备Jar包详解

WebService作为一种跨平台、跨语言的分布式系统通信技术,广泛应用于企业级应用集成中。Axis(Apache eXtensible Interaction System)作为Apache基金会推出的核心SOAP引擎,是实现WebService服务端与客户端交互的重要框架之一。本章将从WebService的基本架构出发,深入剖析Axis的设计理念、核心组件及其在实际开发中的定位。

weixin_35414260的博客 1414

本地Codex接入国外ChatGpt大模型实操:用 AxisApi + CC Switch 配置 Codex,适合新手快速上手

这篇文章介绍了一种简化本地接入ChatGPT大模型Codex的方法,使用AxisApi和CC Switch工具组合配置,适合新手快速上手。主要内容包括: 方案优势:无需海外账号、验证码等复杂流程,注册即可使用 准备工具:AxisApi(中转接口)、CC Switch(配置管理)、Codex(本地运行) 详细步骤:注册AxisApi→小额充值→创建API Key→安装配置CC Switch→安装Codex 常见问题:安装权限、模型选择、配置保存等注意事项 验证方法:简单测试请求确认链路是否通畅 文章提供了完整

a164434275的博客 1527

axis帮助文档(API)

Apache Axis 是 Apache Web Service 项目中的子项目之一,它是 Apache SOAP 项目的延续。Axis 的主要功能是作为一个 SOAP 的实现来让开发者通过它来构建自己的 Web Service(支持 Java 和 C++)。随着 Web Services 以及 SOA 的不断发展,越来越多的人投入到了相关技术的实现、开发和标准的制定的工作中。Apache Axis 凭借它强大的功能和稳定性倍受开发人员的青睐,成为了用于实现 Web Services 的主要途径,在这里提供axis的API

Axis Api和其工具

Axis Api,bin,tools,实例.里面有详细的例子和Api

axis和axis2调用webservice接口

1.axis <dependency> <groupId>axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> import org.apache.axis.client.Call; import org.apache.axis.client.Service; import or

lixu_csdn的博客 3578

axis2的API,axis2 API,axis2帮助文档

axis2的API,axis2 API,axis2帮助文档

客户端使用AXIS的CALL调用

一、客户端使用AXIS的CALL调用 Java代码  package com.common;    import java.net.URL;  import java.util.ArrayList;  import java.util.List;    import javax.xml.namespace.QName;  import javax.xml.rpc.ParameterMode;   

萌萌的It人 www.itmmd.com 4万+

做蛋白组学数据分析,竟然还不会使用DIA-NN软件,走过路过不要错过,进来免费学习!!!

蛋白组学分析工具DIA-NN使用

wcy1995427的博客 9879

antv x6 沿边图标循环动画实现

2.使用transition给边设置动画,利用complte方法实现循环动画。实现效果,如下图,边上存在两个图标,要求图标延边一直循环动画。1.注册一个自定义边,边上定义两个图标,并设置其初始位置。

lingliu0824的博客 3366

axis2 webservice 小例子

<br />参考网上写的。<br /> <br />1 在Apache 的官网下载axis2 的包,这时候下载axis2.war.zip 的包,<br />   下载后解压,将axis2.war包放到tomcat 的webapps下面,启动tomcat<br /> <br />2 在地址栏中输入http://localhost:8899/axis2<br />   出现熟悉的界面,说明Ok了,一般都是好的。<br /> <br /> <br />3 好了我们自学着写个例子,这时候可以参考axis2中自带的一

LEE_ZCF 1390

参考线平滑-FemPosDeviation-SQP

使用SQP(顺序二次规划)对离散点进行平滑

mpt0816的博客 2440

java怎么调用webservice

一、利用jdk web服务api实现,这里使用基于 SOAP message 的 Web 服务      1.首先建立一个Web services EndPoint: package Hello; import javax.jws.WebService; import javax.jws.WebMethod; import javax.xml.ws.Endpoint;

不如养猪! 534

LeGO-LOAM相对LOAM的改进---地面分离的方法-算法原理+代码讲解

实际上此种地⾯分离算法有⼀些简单,我们可以结合激光雷达安装⾼度等其他先验信息进⾏优化,避免将桌子这些当作地面点。LeGO-LOAM中前端改进中很重要的⼀点就是充分利⽤了地⾯点,那⾸先⾃然是提取对地⾯点的提取。理想情况下, 应该接近0,考虑到⼀⽅⾯激光雷达安装也⽆法做到绝对⽔平,另⼀⽅⾯,地⾯也不是绝。对⽔平,因此,这个⾓度会略微⼤于0,考虑到作者实际在草坪之类的场景下运动,因此这个值被设置成。如上图,相邻的两个扫描线束的同⼀列打在地⾯上如AB点所⽰,他们的垂直⾼度差。,计算垂直⾼度差和⽔平⾼度差的⾓度。..

zysss_的博客 776

小白跑WRF第五天,安装WPS和静态地理数据

小白跑WRF第四天,安装WPS一、WPS简介二、下载和安装WPSV4.0第一步、进入Build_WRF文件夹第二步、下载WPSV4.0第三步、解压WPS安装包第四步、修改intmath.f(必须执行)第五步、安装WPS三、修改namelist.wps 一、WPS简介 二、下载和安装WPSV4.0 第一步、进入Build_WRF文件夹 cd Build_WRF 第二步、下载WPSV4.0 下载WPSV4.0的安装包有以下三种方式: 利用Linux命令下载。 进入网站https://www2.mmm.uca

weixin_42372313的博客 2万+

[webservice] 基于Axis2的WebService开发及Demo下载(包含jar包)

首先需要下载axis2的相关jar包,到axis的官方网站即可获得开发的依赖包。 下载地址:http://axis.apache.org/axis2/java/core/download.cgi

qust_2011的专栏 1万+

【TC3xx芯片】TC3xx芯片电源管理系统PMS详解

本文主要介绍了TC3xx芯片的电源管理系统(PMS),重点探讨了供电模式选择、电源监控机制及电源管理模式。文章首先分析了4种供电模式及其硬件配置方式,详细说明了3.3V单电源供电模式的特点;其次阐述了Primary和Secondary两种电源监控机制,包括阈值配置和异常中断处理;最后重点讲解了CPU和系统的电源管理模式,特别对Standby模式及其进入/退出条件进行了详细说明。文章以软件开发视角解析了TC3xx芯片的电源管理功能,为ECU低功耗设计提供了技术参考。

redparrot2008的博客 1531

axis2开发webservice之会话(Session)管理

在看下面文章之前,可以看一下这一篇文章点击打开链接,写的非常好,是我在学习session管理的时候在网上看到的,就转载来了。               WebService给人最直观的感觉就是由一个个方法组成,并在客户端通过SOAP协议调用这些方法。这些方法可能有返回值,也可能没有返回值。虽然这样可以完成一些工具,但这些被调用的方法是孤立的,当一个方法被调用后,在其他的方法中无法获得这个方

亡羊补牢 5620

MATLAB机械臂轨迹规划:在关节空间中生成多项式轨迹以及 jtraj函数(内容超详细讲解)

matlab机器人仿真,关节空间多项式轨迹生成

qq_40969179的博客 1万+

华为OD机试真题 新系统 2026-04-26 Python&JS 实现【项目模块依赖构建顺序规划】

某公司正在开发一个大型软件系统,系统包含 N 个模块,每个模块之间存在构建依赖关系。例如,模块 A 可能依赖于模块 B,这意味着必须先构建模块 B,才能构建模块 A。 请根据依赖关系,输出所有可能的模块构建顺序(按照构建顺序排列模块名称),要求:

MISAYAONE的博客 405

axis2实现WebService之用POJO实现0配置的WebService

参照着网上的教程,自己做了一遍,发现教程是错误百出啊,搞得我弄了一个下午才搞好,废话少说,看招! 一、Axis2的下载和安装     读者可以从如下的网址下载Axis2的最新版本:     http://ws.apache.org/axis2/     在本文使用了目前Axis2的最新版本1.6.2。读者可以下载如下两个zip包:     axis2-1.4.1-bin.zip   f3

亡羊补牢 4002

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

基于Axis2开发WebService-客户端

1. 配置wsdl2java用于生成Java文件。wsdl2java是一个批处理工具,在使用前应增加一个环境变量AXIS2_HOME,配置方法同JAVA_HOME的配置一样。 2.在命令控制行下进入$AXIS2_HOME/bin目录下,执行如下命令 wsdl2java -

小翼的绿茵场 1009

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

基于Axis2开发WebService代码详解

基于Axis2开发WebService代码详解 关键字: webservice 转载:http://tenn.javaeye.com/blog/100755 1.HelloWorld做了些什么? HelloWorld功能非常简单,在客户端输入你的姓名,本例中为ZJ。参数传递到服务器端后,经过处理将返回name+"HelloWorld!",本例中为ZJ HelloWorld!

xtwolf008--关注分布式存储,关注大数据,云计算PAAS 732

java axis2 开发webservice_Axis2实现WebService开发与部署_csdn.doc

利用Axis2实现WebService开发与部署V1.02013-3目 录TOC \o "1-3" \h \u HYPERLINK \l _Toc3072 1 引言 PAGEREF _Toc3072 2HYPERLINK \l _Toc30057 1.1 编写目的 PAGEREF _Toc30057 2HYPERLINK \l _Toc24081 1.2 相关背景 PAGEREF _Toc...

weixin_42510460的博客 303

java使用Axis开发WebService 步骤

使用Axis开发WebService  1.下载并安装Axis  1)登陆http://axis.apache.org/axis/站点下载Axis     下载axis-bin-1_4.zip,解压后的目录结构如下:           2)安装Axis     首先要成功的安装Tomcat,然后将下载的Axis目录下面的webapps中的axis的     整个文件夹全部拷贝到T

Mokily的专栏 874
上一篇: java: axis2 Web Service四种调用模式
下一篇: 使用Axis2的底层API开发Web Service Server端
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值