java 板


LINE

※ 引述《yzlin (自信始终来自於人心)》之铭言: : 1.要输入的栏位 是依不同的web services会有所不同,要如何知道,我是呼叫对的web : services? 假设这只是普通的java类别? 你如何得知方法功能与需要对应的参数? 简单来说WSDL应该有清楚描述才是 以axis2产生的ws为例 documentation标签可以让programer编辑叙述 : 2.当我知道要呼叫web services,要如何把值传过去web servicesꄊ: 请各位高手,是否能帮小弟解答一下,谢谢~! SOAP这就好像WEB APP的REQUEST与RESPONSE 通常WSDL会描述她所接受的SOAP(XML)格式 只要你丢出对应的XML就会回应对应的XML 我手边之前写的范例 假设ws的类别为 public class hello { public String getHello(String str){ return "Hello !! "+str+",Nice to meet you."; } } 透过ws tool产生的WSDL http://127.0.0.1:8080/demo/services/hello?wsdl 取得WDSL WSDL过长 撷取重点 1. <wsdl:documentation>SAY HELLO BABY!~</wsdl:documentation> SWDL描述 2. - <xs:element name="getHello"> - <xs:complexType> - <xs:sequence> <xs:element minOccurs="0" name="str" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> web service的method 当然也包括他的型别与变数名称(str) 3. - <xs:element name="getHelloResponse"> - <xs:complexType> - <xs:sequence> <xs:element minOccurs="0" name="return" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> 回应类型(string) ok开始测试web service 执行 http://127.0.0.1:8080/demo/services/hello/getHello 她就会回传 - <ns:getHelloResponse xmlns:ns="http://webservice.com"> <ns:return>Hello !! null,Nice to meet you.</ns:return> </ns:getHelloResponse> 如果我执行 http://127.0.0.1:8080/demo/service/hello/getHello?str=SpiderName 回传 - <ns:getHelloResponse xmlns:ns="http://webservice.com"> <ns:return>Hello !! SpiderName,Nice to meet you.</ns:return> </ns:getHelloResponse> 看到差异? 就是找到对应的参数罗 当然这种测试方法仅适合AXIS2的平台(因此 此方法不适用XFIRE) 补充一下 如果原PO了解Header(如Accept-Encoding、User-Agent等内容) 不懂可参考http://web-sniffer.net/ 以前我写WEB SPIDER碰到很ㄐ的网站都要靠他... 对以上范例服务丢出 POST http://127.0.0.1:8080/demo/services/hello.helloHttpSoap11Endpoint/ HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "urn:getHello" User-Agent: Jakarta Commons-HttpClient/3.1 Host: 127.0.0.1:8080 Content-Length: 275 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.com"> <soapenv:Header/> <soapenv:Body> <web:getHello> <web:str>SpiderName</web:str> </web:getHello> </soapenv:Body> </soapenv:Envelope> 得到的结果就是上面范例加上SOAP的TAG <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:getHelloResponse xmlns:ns="http://webservice.com"> <ns:return>Hello !! SpiderName,Nice to meet you.</ns:return> </ns:getHelloResponse> </soapenv:Body> </soapenv:Envelope> 我用结果论的展现 不知道原PO有没有FEELING WS测试工具 如Web Service Studio 上网google一下就有啦 -- ◢█◤▏ █ ▎            ◤˙˙◥ 迷 你 邀 武 八 在 你 後 面 , 他 非 常 火 Mini158 is behind you, she is furious. --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.86.130.116 ※ 编辑: slalala 来自: 219.86.130.111 (07/11 12:34)
1F:推 qrtt1:这签名太kuso了,改得真好. 07/11 14:08
※ 编辑: slalala 来自: 219.86.130.111 (07/11 14:17)
2F:→ slalala:这签名很久了 07/11 20:57







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:BuyTogether站内搜寻

TOP