栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Axis2创建Web服务的步骤-客户端代码

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Axis2创建Web服务的步骤-客户端代码

我假设您只对Web服务客户端感兴趣?

选项1

使用Axis2 REST支持来调用Web服务,例如:

http:// localhost:8080 / axis2 / services / MyService / myOperation?param1 =
one&param2 =
two

选项2

使用SOAPUI。通过阅读服务的WSDL,它可以为您生成SOAP消息。我的客户的测试人员仅在对Web服务技术有非常广泛的了解的情况下广泛使用它。令人印象深刻的工具。

选项3

Groovy客户端(与其他基于JVM的语言相同的方法)

使用 wsdl2java 工具为莎士比亚Web服务创建客户机存根类:

generate.sh

$AXIS2_HOME/bin/wsdl2java.sh -d adb -s -o build -uri http://www.xmlme.com/WSShakespeare.asmx?WSDLant -file build/build.xml

GetSpeech.groovy

// Dependencies// ============import com.xmlme.webservices.ShakespeareStub@Grapes([    @Grab(group='org.apache.axis2', module='axis2-kernel', version='1.5.1'),    @Grab(group='org.apache.axis2', module='axis2-adb', version='1.5.1'),    @Grab(group='org.apache.axis2', module='axis2-transport-local', version='1.5.1'),    @Grab(group='org.apache.axis2', module='axis2-transport-http', version='1.5.1'),    @Grab(group='xerces', module='xercesImpl', version='2.6.2'),    @GrabConfig(systemClassLoader=true)])// Main program// ============def stub = new ShakespeareStub()// Request payloaddef request = new ShakespeareStub.GetSpeech()request.setRequest("Friends, romans, countrymen")// Send requestresponse = stub.getSpeech(request)println response.getGetSpeechResult()

使用-cp参数将生成的代码添加到脚本的类路径中

groovy -cp build/build/classes GetSpeech


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/427965.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号