带命名空间的Soap请求

时间:2014-09-25 15:49:11

标签: java web-services soap

我有Web服务客户端,当我发送请求时,soap消息看起来像

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<Open xmlns="ttt:some:namespace">
   <PartnerName>SomeParther</PartnerName>
   <NumberToS>1</NumberToS>
</Open>
</S:Body>
</S:Envelope>

这个不正确的消息。正确的消息看起来像

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:urn="ttt:some:namespace">
<soapenv:Header /> 
<soapenv:Body>
<ttt:Open>
  <ttt:PartnerName>SomeParther</ttt:PartnerName> 
  <ttt:NumberToS>1</ttt:NumberToS> 
</ttt:Open>
</soapenv:Body>
</soapenv:Envelope>

我如何做肥皂请求

    So_Service soService = new So_Service();
    SoPort soPort = soService.getSoaphaSOAP();
    /*  test */
    System.out.println("getServiceName from So_Service" + soService.getServiceName());
    soPort.open("SomeParther", 1);

从So_Service输出getServiceName ttt:some:namespace

我做错了什么?我该怎么做才能正确生成消息?请帮忙

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:urn="ttt:some:namespace">
<soapenv:Header /> 
<soapenv:Body>
<urn:Open>
  <urn:PartnerName>SomeParther</urn:PartnerName> 
  <urn:NumberToS>1</urn:NumberToS> 
</urn:Open>
</soapenv:Body>
</soapenv:Envelope>