java - 如何在 eWay Web 服务上创建 eWayHeader

标签 java web-services soap

我在使用 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 Web 服务上的方法?请帮助我。

最佳答案

这个问题已在这里得到解答 - wsimport doesnt generate code related to soap headers

Adding the option '-XadditionalHeaders' to the wsimport command solved the problem. It generates an extra argument for the method through which the header can be passed/retrieved.

关于java - 如何在 eWay Web 服务上创建 eWayHeader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14993938/

相关文章:

java - 非 BMP 平面字符的 Unicode 转义序列

java - 在Java中创建动态类型列表

java - 为什么显示compile_error?

python - 无法使用 SOAPpy 调用 Web 服务方法

php - 在 WSDL 文件中为服务提供者使用动态 IP 地址

java - Apache Axis Web 服务是否支持 ArrayList?

c# - 如何在 IClientMessageInspector 中获取调用的操作名称?

php - 使用 PHP SoapClient 访问 Magento API 导致重定向 - 通过浏览器访问有效

java - 带直方图计时器的 Spring Boot 2.x 矩阵

java - 将 Soap 消息发送到 JMS 队列