java调用wsdl,Java调用wsdl接口返回空

http://www.itjxue.com  2023-01-07 00:02  来源:未知  点击次数: 

使用java根据wsdl文件生成的访问接口类调取数据反应很慢?

在接口调用方法逐行加日志,然后分析耗时长的原因呗,是否在调用前和调用后又insert日志流水到数据库?是否有更新数据库的操作?是否存在第三方认证相关的过滤器?是否存在不必要的过滤器?这些操作都有可能存在性能瓶颈,性能调优的方法一般也就是定位瓶颈代码,然后优化导致速度慢的代码。

java调用webservice

String endpoint="";

String id = "11111";

Service service = new Service();

Call call = (Call) service.createCall();

call.setTargetEndpointAddress(new URL(endpoint));

call.setOperationName("webservice方法名");

String res = (String) call.invoke(new Object[] {id});

看了你的描述觉得你把webservice想得太复杂化了,其实就是一个jar包和几个类。

以上就是最简单的webservice客户端用法,和反射有点像。当然返回值不一定是String,返回的类型和格式要问服务提供方。

我用的是axis的,我不了解websphere什么的,但是webservice就是那么易用的东西。

请采纳。

java webservice怎么生成wsdl文件

在大多数情况下我们都需要为我们的服务提供一个WSDL文件,而 Axis2's Java2WSDL 是专门用来生成WSDL文件的D专用工具,如果你要在命令行模式下进行生成WSDL文件,首先需要保证你的环境变量AXIS2_HOME是否已经配置OK,同时还要保证把%AXIS2_HOME%\bin加入到你的path环境中,要生成 WSDL文件,首先要保证你的class能够编译成功,而且已经编译成功,然后进入class文件编译后的根目录(在JBuilder中是classes,在Eclipse中是bin目录)这时,生成WSDL文件的准备工作已经OK。\x0d\x0a\x0d\x0a下面是生成WSDL文件时的可选参数和参数说明:\x0d\x0a---------------------------------------------------------------------------------\x0d\x0aUsage java2wsdl -cn : class file name\x0d\x0a-o : output file location\x0d\x0a\x0d\x0a-cp : list of classpath entries - (urls)\x0d\x0a\x0d\x0a-tn : target namespace\x0d\x0a\x0d\x0a-tp : target namespace prefix\x0d\x0a\x0d\x0a-stn : target namespace for schema\x0d\x0a\x0d\x0a-stp : target namespace prefix for schema\x0d\x0a\x0d\x0a-sn : service name\x0d\x0a\x0d\x0a-of : output file name for the WSDL\x0d\x0a\x0d\x0a-st : style for the WSDL\x0d\x0a\x0d\x0a-u : use for the WSDL\x0d\x0a\x0d\x0a-l : address of the port for the WSDL\x0d\x0a\x0d\x0a-nsg : fully qualified name of the class that implements NamespaceGenerator\x0d\x0a\x0d\x0a-p2n [,,] ...\x0d\x0a\x0d\x0a-efd : Setting for elementFormDefault (defaults to qualified)\x0d\x0a\x0d\x0a-afd : Setting for attributeFormDefault (defaults to qualified)\x0d\x0a\x0d\x0a-xc : Extra class for which schematype must be generated.\x0d\x0aUse as : -xc class1 -xc class2 ...\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a典型地,进入你的工程的二进制编译根目录,执行命令模板如下:\x0d\x0ajava2wsdl -cp . -cn [PACKAGENAME].[CLASSNAME]-of [FILENAME].wsdl\x0d\x0a\x0d\x0a现在我们假设在samples.helloworld.service.axiom;包下面有个HelloWorldService类,工程的类文件编译后存放在build\classes目录下,那么,首先进入该目录中,然后执行以下命令:\x0d\x0ajava2wsdl -cp . -cn samples.helloworld.service.axiom.HelloWorldService -of HelloWorldService.wsdl\x0d\x0a\x0d\x0a执行后的CMD提示如下说明已经成功执行了:\x0d\x0a\x0d\x0aUsing AXIS2_HOME: D:\axis2-1.1.1\x0d\x0aUsing JAVA_HOME: C:\Program Files\Java\jdk1.5.0_06

java调用webservice,命名空间和方法名指的是什么

1.xml

2. wsdl: webservice description language web服务描述语言

通过xml格式说明调用的地址方法如何调用,可以看错webservice的说明书

3.soap simple object access protoacl (简单对象访问协议)

限定了xml的格式

soap 在http(因为有请求体,所以必须是post请求)的基础上传输xml数据

请求和响应的xml 的格式如: Envelop

body

//....

/body

/Envelop

operation name:服务提供的方法

静态方法不能发布为外部服务

运用jkd自带的代码生成访问服务器的客户端代码 E:/wsimort -s .

我们可以把webservice看做是web服务器上的一个应用,web服务器是webservice的一个容器

函数的参数在

JAX-WS是指 java api for xml -WebService

//测试 WebService服务的 explorer

Web Service Explorer 可以显示返回的xml格式

targetNamespace 默认为倒置的包名

客户端调用WebService的方式:

1.通过wximport生成代码

2.通过客户端编程方式

3.通过ajax调用方式

4.通过 URL Connection 方式调用

请求过程分析:

1.使用get方式获取wsdl文件,称为握手

2.使用post发出请求

3.服务器响应成功过

(责任编辑:IT教学网)

更多

推荐XML/XSLT文章