webService【二】

【python快速编程入门(第二版)黑马程序员课后编程题】 python快速编程入门(第二版)黑马程序员课后编程题 阅读详情

一、使用JDK发布webService

  1.编写自己的服务类
package cn.sp.server;

import javax.jws.WebMethod;
import javax.jws.WebService;
/**
 * 使用jdk发布服务,需要在类上打注解
 * @author 2YSP
 *
 */
@WebService
public class SayHelloService {
	/**
	 * 1.访问修饰符必须是public
	 * 2.不能被static修饰
	 * 3.不能是final
	 * 4.至少要有一个可发布的方法
	 * @param name
	 * @return
	 */
	public String sayHello(String name){
		return name+" hello";
	}
	@WebMethod(exclude=true)//可以发布多个服务,也可以使用该注解选择不发布此方法
	public String sayGood(String name){
		return name+" good";
	}
}
package cn.sp.server;

import javax.xml.ws.Endpoint;

/**
 * 发布服务的类
 * @author 2YSP
 *
 */
public class ServicePublish {

	public static void main(String[] args) {
		String address="http://127.0.0.1:8080/hello";//发布的地址
		Endpoint.publish(address, new SayHelloService());//具体的实现类
	}

}

  然后,在游览器访问http://127.0.0.1:8080/hello?wsdl出现如图所示的网页表示成功

接着就可以使用命令wsimport -s . -p cn.sp.hello http://127.0.0.1:8080/hello?wsdl来获取对应的代码了。
2.导入代码并编写客户端代码。
package cn.sp.test;

import cn.sp.hello.SayHelloService;
import cn.sp.hello.SayHelloServiceService;
/**
 * 调用服务的客户端
 * @author 2YSP
 *
 */
public class TestSayHelloClient {

	public static void main(String[] args) {
		//创建服务访问点集合
		SayHelloServiceService sh = new SayHelloServiceService();
		//根据服务访问点获得绑定的类
		SayHelloService service = sh.getSayHelloServicePort();
		//调用服务
		String result = service.sayHello("zhouyu");
		System.out.println(result);
	}

}
先启动发布服务类,在运行TestSayHelloClient中的main方法,结果如下。
Android 13.0仿ios的hotseat效果修改hotseat样式 在13.0系统产品rom定制化开发中,在项目需求的需要,系统原生Launcher的布局样式很一般,所以需要重新设计ui对布局样式做调整,产品在看到 ios的hotseat效果觉得特别美观,所以要仿ios一样不需要横屏铺满的效果 居中显示就行了,所以就要看hotseat的具体布局显示了 阅读详情

相关推荐

知识图谱初步学习(一)——本体+Protege新手学习

文章目录前言(本体详解)1.本体概念2.本体分类3.本体组成4.本体构建方法一、protege简介二、软件使用步骤1.安装2.使用三、问题解决方案汇总 前言(本体详解) 在开始学习知识图谱的过程中,首先就是要了解什么是本体(ontology)。 1.本体概念 本体的概念最初源自于哲学领域,在哲学中的定义为“对世界上客观事物的系统描述,即存在论”。哲学中的本体关心的是客观现实的抽象本质。而在计算机领域,本体是可以在语义的层次上来对知识进行描述,可以看做是某一个领域知识的通用模型。 本体是从客观世界中抽象出来

qq_43654669的博客 3万+

webService接口编写并发布与webService接口的调用(二)

webService接口的调用的两种方法 1. 根据接口url生成客户端代码,再根据生成的代码调用接口服务 (1)使用eclipse在需要调用接口的项目目录里的src上右键,选择new,如图: (2)点击next录入webService接口的url地址 http://localhost:8089/testservice?wsdl。如图: (3)点击Finish按钮,自动生成客户端代码了,根据客户端设置的包路径查看代码,如图: (4)创建一个调用接口示例,TestServiceClient类: publ

qq_36216193的博客 696

深度解析 Android 开发工程师岗位:技术栈、职责与面试全攻略

本文深度剖析Android开发工程师职位要求,从核心技术栈到面试准备进行全面解读。关键点包括:1)掌握Kotlin语言特性和Jetpack组件;2)具备UI开发、性能优化和逆向分析能力;3)理解MVVM架构和Room数据库;4)熟悉常用工具链和开发流程。文章提供了详细的面试题库及解析,涵盖基础概念、UI优化、架构设计等方向,并给出职业发展建议:夯实基础、拓展技术广度、培养工程素养。旨在帮助开发者系统性地准备Android岗位求职,把握移动开发领域的技术趋势。

郑伟强dev的专栏 184

WebService: SpringBoot集成WebService实践二

该篇为上一篇的延伸,上一篇知识简单介绍了WebService 的使用,该篇会对代码中模块及功能进行详细介绍,以作对WebService 进一步的理解。

GIS摆渡人 634

广联达Linkworks ArchiveWebService XML实体注入漏洞复现

广联达 LinkWorks /GB/LK/Document/ArchiveService/ArchiveWebService.asmx接口处存在XML实体注入漏洞,未经身份认证的攻击者可以利用此漏洞读取系统内部敏感文件,获取敏感信息,使系统处于极不安全的状态。

0xSec 2724

Python-增加b站视频播放量

如果条件允许的情况下,有代理API更好,每次请求url调用API也更方便。如果没有的话,也不用担心,网上本身也有着很多免费国内代理,不过代理是否可用需要自己花点时间去检测,检测方法笔者这里就不详述了,后面有时间的话会单独针对这一块做详细说明。在开始之前,需准备代理IP。总之,在每次请求url的时候,随机带入某个IP防止被平台检测,便于达到增加播放量预期。大致思路就是针对你的目标代理平台进行IP抓取,并存入到自己本地的IP代理池。本文是该专栏的第1篇,后面会持续更新对应平台干货知识,记得关注。

Python进阶专栏《爬虫实战进阶》,《Pyppeteer从入门到精通》原创作者 5225

webservice学习二之调用天气的webservice及wsdl分析

我们首先要得到天气预报的webservice文档,天气预报的webservice接口是免费的 这个是webservcie的文档 http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl 然后我们按照第一篇蚊帐中的,测试一下wsdl文档能不能用,我们发现报错,当webservice是用.net写的,这个时候用java调用....

qq_27922171的博客 3335

工业质检封神!YOLOv8实战金属表面缺陷检测,自建数据集mAP突破95%

本文详细介绍了基于YOLOv8的金属表面缺陷检测实战方案。针对工业质检中的光照不均、纹理复杂、小样本等挑战,作者构建了12000张图像的数据集,提出针对性数据增强策略和两阶段训练方法。通过优化损失函数、调整超参数等技术手段,最终在测试集上达到95.1%的mAP@0.5,检测速度32FPS。相比传统方法,该方案在精度和鲁棒性上均有显著提升,为工业视觉质检提供了可复现的落地解决方案。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 430

WebService介绍(二):发现WebService

WebService介绍(二):发现WebService         在我们的实例中,对于通讯运营商来说,缴费的WebService存在于银行的服务器上,通讯运营商只是该WebService的使用者,或者说消费者。要使用缴费的WebService,必须知道该WebService在哪里,以及怎样才能找到它。 下面先介绍在VS 2005.net中如何自动的发现WebService。先在

姚建友的专栏 3245

Neo4j LLM知识图谱构建器使用教程

是一个开源应用程序,旨在将非结构化数据(如PDF、文档、文本、YouTube视频、网页等)转换为存储在Neo4j中的知识图谱。该项目利用大型语言模型(如OpenAI、Gemini等)从文本中提取节点、关系及其属性,并通过Langchain框架创建结构化的知识图谱。

u013250861的博客 545

【DeepSeek开发入门】DeepSeek API 开发初体验

在人工智能蓬勃发展的时代,DeepSeek作为一款功能强大的AI大模型,为开发者提供了丰富的接口和便捷的开发体验。本文将基于DeepSeek的几个关键接口,带你快速入门,开启DeepSeek开发的探索之旅。通过本文,你已经初步了解了DeepSeek开发中几个重要接口的使用方法,包括列出模型、对话补全和查询余额接口,以及开发过程中的常见问题及解决办法。这是你踏入DeepSeek开发领域的第一步。在后续的学习中,你可以深入研究模型的参数调优,探索不同模型在各种场景下的应用,如利用模型实现更复杂的推理对话功能。

寻道AI,探索AI无限可能! 2787

WebService专题(二)-WebService原理

1.WebService原理 Webservice是使用Http发送SOAP协议的数据的一种远程调用技术 Webservice要开发服务端 Webservice要开发客户端 Webservice客户端开发需要阅读服务端的使用说明书(WSDL) 2.WebService模拟 服务器端 public class WeatherServer { public static void mai...

专业的计算机毕业设计指南 604

Python地理数据处理 十七:植被物候提取和分析(Savitzky-Golay)

植被是陆地生态系统中最重要的组分之一,也是对气候变化最敏感的组分,其在全球变化过程中起着重要作用,能够指示自然环境中的大气、水、土壤等成分的变化,其年际和季节性变化可以作为地球气候变化的重要指标。此外,由于生态工程保护建设和植被自然生长等因素,中国陆地生态系统发挥了重要的碳汇作用。因此,定量评估植被时空动态变化是制定生态系统可持续发展目标和衡量生态系统固碳潜力的重要前提,卫星遥感数据衍生的生态参量产品为研究长时间序列全球及区域植被时空变化提供了重要数据源。SG滤波能够对物候信息进行平滑,并提取其中的物候信息

amyniez的博客,欢迎交流讨论 4250

WebService学习二

了解了webservice的基础知识之后,我们来编写一个服务端和客户端,进行测试。 服务端 先写一个接口: @WebService public interface WebServiceI { //使用@WebMethod注解标注WebServiceI接口中的方法 @WebMethod String sayHello(String name); ...

weixin_30625691的博客 98

深度学习工具包 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")

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

webservice二

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34179968的博客 108

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

WebService学习总结(二)——使用JDK开发WebService

WebService学习总结(二)——使用JDK开发WebService 一、WebService的开发手段   使用Java开发WebService时可以使用以下两种开发手段     1、使用JDK开发(1.6及以上版本)     2、使用CXF框架开发(工作中) 二、使用JDK开发WebService 2.1、开发WebService服务器端   1、定义一个interface,使用@WebService注解标注接口,使用@WebMethod注解标注接口中定义的所有方法,如下所示: .

a754315344的博客 416

webservice开发二:使用CXF开发webservice

下载CXF框架首先 http://cxf.apache.org/download.html 从此目录下载 apache-cxf-2.7.18.zip 包,并导入项目

1992的小明 425

j2ee中webservice示例二之测试webservice

主要类代码如下: DemoAction.java:

daxiang的专栏 1261

WebService学习总结(二)——WebService相关概念介绍

一、WebService是什么?   1. 基于Web的服务:服务器端整出一些资源让客户端应用访问(获取数据)   2. 一个跨语言、跨平台的规范(抽象)   3. 多个跨平台、跨语言的应用间通信整合的方案(实际) 二、为什么要用Web service?   web service能解决: 跨平台调用 跨语言调用 远程调用 三、什么时候使用web Service?   1. 同一...

Andrewniu的博客 281

WebService学习(二)——WebService相关概念介绍

一、WebService是什么?  1. 基于Web的服务:服务器端整出一些资源让客户端应用访问(获取数据)  2. 一个跨语言、跨平台的规范(抽象)  3. 多个跨平台、跨语言的应用间通信整合的方案(实际)二、为什么要用Web service?  web service能解决:跨平台调用跨语言调用远程调用三、什么时候使用web Service?  1. 同一家公...

weixin_40571495的博客 139

WebService学习(二)

很好的一个连接,关于WebService的学习: https://www.cnblogs.com/xdp-gacl/p/4260627.html 一、找到提供服务的天气预报信息的WebService的网络地址由 http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx 更改为 http://www.webxml.com.cn/Web...

qq_37358143的博客 215

webservice(二)

---摘自网络,感谢提供者 WsExplorer和Tcp/Ip Monitor工具本身就存在于eclipse和MyEclipse中使用工具的原因:1、 使用工具可以更好的了解WebService请求的过程2、 使用工具WsExplore可以获取SOAP数据发送和接收的格式3、 使用工具Tcp/Ip Monitor可以监控拦截器请求头和响应头的具体数据什么是SOAP...

dianrenjiang7330的博客 192

WebService学习总结二 使用JDK开发WebService

一 服务器端:包括要发布的接口SEI,接口实现类和接口的发布类 1 SEI接口:使用@WebService和@WebMethod两个注解,一个加在接口上一个加在方法上。 2 SEI实现:使用@WebService,加在实现类上。 3 服务发布类:在main方法里使用 Endpoint.publish(发布路径, 接口实现类)进行发布; 二  测试发布的接口:使用浏览器访问 发布路径?wdl

男儿当自强 901

WebService认识二(使用Servlet搭建WebService服务)

注:在WebService认识一的基础之上

WJL_MGQS的专栏 6021

二、基于java 的webService

二、基于java 的webService 1.创建java project 2.建立接口 并添加@WebService package cn.mldn.hz.webservice; import javax.jws.WebService; @WebService public interface IFirstWebService { public void add(int par...

走在java的路上 149

vb调用webservice(二)

<br />利用SOAP协议<br />首先,需要引用 microsoft xml 6.0<br />在客户端调用时<br />'定义soap消息 这个消息可以在webservice调用过程获得。主要处理在soap12:Body<br />   Dim strtest As String<br /><br />'    strtest = "<?xml version=""1.0"" encoding=""utf-8""?> "<br />'    strtest = strtest + " <soap12

fly的专栏 5258
上一篇: webService【一】
下一篇: cxf整合spring练习
2YSP
博客等级 码龄10年 12粉丝 34原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址