作者: 
cpc (Johnny)   
2014-12-16 23:16:54最近在學習建立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,
還請有對這塊有經驗的版友幫幫忙解答囉~
感謝~