0

我在使用 eWay 网络服务时遇到了问题。
我通过 wsimport 使用https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx?WSDL
创建了客户端 ws 生成文件后,我调用了 ws 的方法

ManageRebillTestSoap soap = new ManageRebillTest() .getManageRebillTestSoap();
CustomerDetails details = soap.createRebillCustomer(....);

消息返回错误是:根据其数据类型,“eWayCustomerID”元素的值无效。

Soap 消息的格式是

<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:Header>
    <eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
      <eWAYCustomerID>string</eWAYCustomerID>
      <Username>string</Username>
      <Password>string</Password>
    </eWAYHeader>
  </soap:Header>
  <soap:Body>
    <CreateRebillCustomer xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
      <customerTitle>string</customerTitle>
      <customerFirstName>string</customerFirstName>
      <customerLastName>string</customerLastName>
      <customerAddress>string</customerAddress>
      <customerSuburb>string</customerSuburb>
      <customerState>string</customerState>
      <customerCompany>string</customerCompany>
      <customerPostCode>string</customerPostCode>
      <customerCountry>string</customerCountry>
      <customerEmail>string</customerEmail>
      <customerFax>string</customerFax>
      <customerPhone1>string</customerPhone1>
      <customerPhone2>string</customerPhone2>
      <customerRef>string</customerRef>
      <customerJobDesc>string</customerJobDesc>
      <customerComments>string</customerComments>
      <customerURL>string</customerURL>
    </CreateRebillCustomer>
  </soap:Body>
</soap:Envelope>

在上面的方法上只需添加<Soap:Body> 任何人都知道添加 eWayHeader 或<soap:Header>在 eWay webservice 上调用方法时?请帮我。

4

1 回答 1

1

这已在此处得到解答 - wsimport 不会生成与肥皂标头相关的代码

向 wsimport 命令添加选项“-XadditionalHeaders”解决了这个问题。它为可以传递/检索标头的方法生成一个额外的参数。
于 2013-02-25T00:16:21.663 回答