作者cpc (Johnny)
看板java
标题[问题] 用JAX-WS 制作 SOAP web service问题
时间Tue Dec 16 23:16:54 2014
最近在学习建立web service,实作概念大概同这篇教学范例,
http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/
执行上一切都没问题,
由於每次透过JAX-WS建立的service,SOAP request中的Method一定会有namespace
如下getHelloWorldAsString method 的 ns2:
<S:Envelope xmlns:S="
http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<
ns2:getHelloWorldAsString xmlns:ns2="
http://XXXXXXX">
<arg0>Hello world PTT!</arg0>
</
ns2:getHelloWorldAsString>
</S:Body>
</S:Envelope>
可是我希望的需求架构是在Method Tag内不想要有出现namespace,
像是webserviceX内的这个例子,
( http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry )
<soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCitiesByCountry xmlns="
http://www.webserviceX.NET">
<CountryName>string</CountryName>
</GetCitiesByCountry>
</soap:Body>
</soap:Envelope>
如上soap body内的method都是不带有namespace的,
我试过网路上一些解法,像是设定targetNamespace=""等等
不知道是没设好还是怎样的完全都没效果,
没有办法制造出可以吃 method 没有 namespace 的request,
还请有对这块有经验的版友帮帮忙解答罗~
感谢~
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.225.89.31
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/java/M.1418743018.A.16D.html
※ 编辑: cpc (36.225.89.31), 12/16/2014 23:20:14
1F:推 reon: 可能要从你的WSDL去改... 12/20 11:57