import java.io.IOException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.soap.SOAPException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class NewAxisClient {
private static final String STATUSCODE_SUCCESS = "0";
private static final String STATUSCODE_ERROR1 = "1";
private static final String STATUSCODE_ERROR2 = "2";
private static final String STATUSCODE_ERROR3 = "3";
private static final String STATUSCODE_ERROR4 = "4";
private static final String STATUSCODE_ERROR5 = "5";
private static final String STATUSCODE_OTHTERS = "6";
// url
private String endpoint = "http://localhost:9080/ws/services/Ws";
// 命名空间
private String namespace = "http://ws.test.com";
// 调用的方法名
private String method = "sendSms";
public String getEndpoint() {
return endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public String getNamespace() {
return namespace;
}
public void setNamespace(String namespace) {
this.namespace = namespace;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String sendSms(long id, String appKey, String phoneNums,
String content, long time) throws SOAPException, IOException,
InterruptedException, ServiceException {
System.out.println("Initialize Service....");
// 首先创建service对象
Service service = new Service();
System.out.println("Create Call object.");
System.out.println("Create Call object."+"endpoint:"+endpoint);
System.out.println("Create Call object.");
System.out.println("Create Call object.");
// 通过service对象来创建call对象
Call call = (Call) service.createCall();
// 设置web服务URL
call.setTargetEndpointAddress(new URL(endpoint));
System.out.println("Set Operation.");
// 设置操作方法名称,注意这里要明确命名空间,因为axis默认的命名空间与weblogic不同
call.setOperationName(new javax.xml.namespace.QName(namespace, method));
// 加入参数设置,同样要注意命名空间
call.addParameter(new QName(namespace, "id"), XMLType.XSD_LONG,
ParameterMode.IN);
call.addParameter(new QName(namespace, "appKey"), XMLType.XSD_STRING,
ParameterMode.IN);
call.addParameter(new QName(namespace, "phoneNums"),
XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter(new QName(namespace, "content"), XMLType.XSD_STRING,
ParameterMode.IN);
call.addParameter(new QName(namespace, "time"), XMLType.XSD_LONG,
ParameterMode.IN);
// 定义服务调用返回的数据类型
call.setReturnType(XMLType.XSD_STRING);
call.setSOAPActionURI(namespace + "/" + this.method);
System.out.println("Invoke Service.");
// 调用web服务,并返回结果
String statusCode = (String) call.invoke(new Object[] {
Long.valueOf(String.valueOf(id)), appKey, phoneNums, content,
Long.valueOf(String.valueOf(time)) });
return CodeToStr(statusCode);
}
public String CodeToStr(String code) {
if ("0".equals(code)) {
return STATUSCODE_SUCCESS;
} else if ("1".equals(code)) {
return STATUSCODE_ERROR1;
} else if ("2".equals(code)) {
return STATUSCODE_ERROR2;
} else if ("3".equals(code)) {
return STATUSCODE_ERROR3;
} else if ("4".equals(code)) {
return STATUSCODE_ERROR4;
} else if ("5".equals(code)) {
return STATUSCODE_ERROR5;
} else {
return STATUSCODE_OTHTERS;
}
}
/**
* 测试此类的主程序入口
*
* @param args
* 命令行参数
*
*/
public static void main(String[] args) {
NewAxisClient client = new NewAxisClient();
client.setEndpoint("http://localhost:9080/ws/services/Ws");
client.setNamespace("http://ws.test.com");
client.setMethod("sendSms");
try {
String strXml = client.sendSms(1, "afdasfas", "11111111111",
"xxxxxxxx", System.currentTimeMillis());
System.out.println(strXml);
} catch (Exception se) {
se.printStackTrace();
}
}
}
相关推荐
华为防火墙NAT避坑指南:当双ISP出口遇到服务器发布,这些细节不注意会翻车
本文深入解析华为防火墙在双ISP出口环境下服务器发布的实战配置,重点探讨no-reverse参数对Server-Map表的影响、源进源出功能的实现及线路切换时的会话保持问题。通过策略路由和智能选路技术,确保HTTP/FTP服务在多运营商链路中的高可用性,避免路径不对称和NAT映射冲突等常见陷阱。
使用axis调用WebService,Java WebService调用工具类
Java 调用WebService工具类。导入即使用。
金融行业软件测试面试题(含答案)
6、假如发现了一个BUG,跟开发本身没什么关系,涉及到理念,需求问题,如何解决?11、假如要你测试6个月期限的p2p借款产品,你应该怎么设计案例,说出测试点。17、如果京东有一个购物网页给你,你要怎么进行测试?31、我们公司自动化测试用的语言是Java,Java你不会,该怎么办?23、你们测试用的测试环境是谁给的?24、如果领导分配你的任务超出负荷,领导高估了你的能力,怎么办。26、给你一个模块测试,只有一个星期的时间你如何有效率地完成?29、如果你组长的用例写错了,但他认为是对的,你怎么处理?
axis调用webservice服务
axis调用webservice远程服务
大华事件检测智能服务器,大华股份:高速公路智能事件检测 解决方案
1方案背景随着我国基础设施建设的飞速发展,公路尤其是高速公路的总里程数年年攀升。交通运输部统计数据显示,截止2017年底全国公路总里程477.35万公里,其中高速公路13.65万公里,位居世界第一。高速公路的运营和管理作为全国交通管理的重要组成部分日益受到严峻挑战,交通拥堵和事故频发已成为高速公路上非常突出的问题。抛洒物、行人、车辆不规则行驶等事件是导致以上结果的重要原因。基于视频分析的高速公路智...
国内合规开通ChatGPT Plus实操指南:银行卡绑卡与支付全解析
ChatGPT Plus 是 OpenAI 官方推出的高级订阅服务,基于 GPT-4o 多模态大模型提供语音交互、图像理解与长上下文处理能力。其核心使用前提在于完成合规的国际支付绑定,而非网络接入方式。技术原理上,OpenAI 采用 Stripe 支付网关进行风控校验,重点匹配银行跨境权限、卡片类型(仅支持 Visa/Mastercard/Amex 信用卡)、BIN 号段及地理位置一致性。该机制决定了95%的绑卡失败源于银行端配置缺失或卡片不兼容,而非网络问题。实际应用中,PayPal 作为中间支付层可显著
使用axis调用WebService
公司项目有一个给用户发送短信的需求,需要调用一个.NET写的WebService。在写客户端过程中,遇到了不少的问题,在这里整理下,也希望和我遇到同样问题的小伙伴些少走点弯路。 直接上代码: public static boolean send(String MsgContent, String DestNumber){ boolean res = false...
Qt+VS集成高德红外相机SDK与OpenCV的采图实践
本文详细介绍了在Qt和Visual Studio环境中集成高德红外相机SDK与OpenCV的完整实践方案。涵盖环境配置、SDK初始化、图像采集与处理、多线程优化等关键技术点,重点解决了高德红外相机数据转换、温度信息提取和Qt界面显示优化等核心问题,为红外图像处理应用开发提供可靠参考。
使用axis调用WebService,Java WebService调用工具类,2024年最新看完必懂
/ log.info(“调用 WebService 发送参数==>” + MapperUtils.mapToJson(params));// log.info(“调用 WebService 发送参数==>” + MapperUtils.mapToJson(params));// log.info(“调用 WebService 发送参数==>” + MapperUtils.mapToJson(params));* @param params 参数。* @param params 参数。
光学遥感显著目标检测初探笔记总结
一张图片里最吸引注意力的部分就是显著性物体,其实是模拟人的一个注意力机制。目标是希望通过计算机的方法让我们自动定位和模拟人的这种感知能力,从而去定位场景中的一个让人感兴趣的目标。
线性回归做糖尿病分析(diabetes数据集),并分析单个特征值与病情的关系
1.diabetes数据集 共442个样本,每个样本有十个特征,分别是 [‘age’, ‘sex’, ‘bmi’, ‘bp’, ‘s1’, ‘s2’, ‘s3’, ‘s4’, ‘s5’, ‘s6’],对应年龄、性别、体质指数、平均血压、S1~S6一年后疾病级数指标。 Targets为一年后患疾病的定量指标,值在25到346之间。 ...
axis service没有配置namesapce 如何设置QName namesapce
QName opTest = new QName("","test");
python基础知识补充
1. jupyter notebook 解释 2. ipython 魔法命令 3. latex in Markdown cell(在markdown里面编写数学公式) 4. jupyter notebook功能扩展:安装Nbextension 5. python解释与运行 6. 垃圾回收(计数机制与分代回收机制) 7. 名字空间与局部作用域L和全局作用域G 8. 小整数缓存区与字符驻留 9. Statement &Expression 10. 调试
axis2小例子进阶一
目的:测试是否有输入,输出的各种情况。 往Hello.java增加几个方法,代码如下 /** * 这里没有包名,直接放到webapps\axis2\WEB-INF\pojo 目录下. * @author abc * */ public class Hello{ public String getGreeting(String name) { retu
InTheHand.Net.Personal+BlueTooth4,蓝牙开发
项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。
全球国家地区城市数据
MySQL全球国家地区城市数据报。。。。。。。。。。。。
使用CXF、Axis2调用WebService
最近项目中又要调用其他系统的WebService ,同时呢本项目也需要提供webService 服务,有几年没有用CXF 、Axis2 、xfire 这三个框架了,本来想写详细点,一回想这三个框架内容实在太多,所以这里简单写下CXF、Axis2调用WebService 吧! 关于CXF AXIS2 发布webService 在另外的博客在写吧!主要是想记录和给组里其他没用的 能够尽快
深度学习工具包 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');```[](https://bitdeli.com/free "Bitdeli Badge")
Axis1.4 依赖的jar包,maven配置
Axis 1.4依赖的jar包Maven配置文件<!-- axis 1.4 jar start --> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version>
霍尼韦尔SoftMaster使用说明
霍尼韦尔SoftMaster使用说明
利用axis调用webservice
比如我们需要调用第三方webservice接口,如这个地址:获得随机数字或字母http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx?wsdl一、准备需要的jar包 在maven项目中,pom的依赖如下<!-- axis --> <dependency> <groupId>o...
关于AXIS2发布Webservices和调用webservice
第一步: 创建web项目 编写接口和实现类 具体包路径结构如下 package com.colde.webservice.server; public interface IWebServiceServer { public String saySomething(String str1,String str2,String str3,String str4,String str5...
AXIS之一:AXIS技术的一个问题
前天做技术交流,有一位同仁针对下面的一段AXIS客户端代码提出了这样的问题:QName qname=new QName("SparePartDetails","SparePartBean");这2个参数是什么意义? String endpointURL = "http://localhost:8080/ws/services/SparePartService"; String metho...
利用axis调用webservice接口
一.首先把wsdl文件放入eclipse中某个项目中的src目录下 二.右键弹出webservice,然后点击webservice菜单,选中genernator client ,选择axis生成Java文件 三,然后调用. 调用说明(其中一种的调用方式): DHSFServiceLocator service = new DHSFServiceLocator();servic...
axis2的qname not fond for the package问题的解决
June 15, 2011 | 作者:白菜 在一个项目组,需要用到webservice,虽然现有的webservice组件为axis2,比较古老了,不过夜没办法,是个老项目。 不过AXIS2还算好用,就是还是复杂了一些。 在部署webservice的时候,我们可以通过这样的方法来在浏览器中测试 http://aiyooyoo.com/service/getStudentService/...
java调用webservice WSDL形式接口之apache axis方式调用(一)
1. 先说一下什么是webservice webservice的 发布一般都是使用WSDL(web service descriptive language)文件的样式来发布的,在WSDL文件里面,包含这个webservice暴露在外面可供使用的接口。 (1)WebService是一个SOA(面向服务的编程)的架构,它是不依赖于语言,不依赖于平台,可以实现不同的语言间的相互调用,通过Int
使用axis轻松调用Webservice
使用axis1.4调用webservice有两种简单的方式: 1、直接使用axis提供的API调用,适用于webservice接口的参数和返回值都是String的情况。 try { Call call = (Call)new Service().createCall(); call.setTargetEndpointAddress("http://192.168.1.234:8080/...
webservice学习之AXIS初学笔记--创建自己的webservice
AXIS框架共有两种发布方式:即时发布(JWS-Java Web Service)和定制发布(WSDD)。 我对这两种方式分别做了测试,由于时间关系,我只在此说明一些关键性的步骤。 一:即时发布(JWS) 服务器端:创建一个java项目jwstest_server,创建一个jws_server类,代码如下 public class jws_server { public String t
Oracle根据开始结束日期循环打印中间的日期_hanCSDN_201306014
declare p_date varchar2(32); p_nextdate varchar2(32); p_lastdate varchar2(32); p_date_date date; p_nextdate_date date; begin p_date :='2013-05-01'; p_lastdate:='2013-05-31';
555




被折叠的 条评论
为什么被折叠?



