Eclipse Java CXF 2.7.9上的Webclient-修复格式错误的.wsdl文件

问题描述 投票:0回答:1

由于其他人使用Apache Axis版本1.4创建了格式错误的WSDL定义,因此我很难创建WSDL客户端。

让我告诉您我正在执行的步骤:

首先,我在SOAP IU上加载我的WSDL端点http://xxxxx/uglySoap?wsdl。该程序自动生成以下请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bal="http://xxxx/uglySoap.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <bal:CreditRequest>
         <bal:MSISDN>?</bal:MSISDN>
         <bal:amountToCredit>?</bal:amountToCredit>
         <!--Optional:-->
         <bal:reason>?</bal:reason>
         <bal:transId>?</bal:transId>
      </bal:CreditRequest>
   </soapenv:Body>
</soapenv:Envelope>

此请求是错误的,因为它缺少标题(您在其中提供凭据)。在SOAP UI上,这不是问题,我可以手动添加缺少的文本,并且可以完美运行。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:msp="http:xxxxxx/uglySoap.xsd" xmlns:bal="http://xxxxxx/uglySoap.xsd">
   <soapenv:Header>

          <msp:messageHeader>
         <msp:trackingMessageHeader>
            <msp:messageId>xxx</msp:messageId>
            <msp:carrierId>xxx</msp:carrierId>
            <msp:userId>xxxx</msp:userId>
            <msp:password>xxxx</msp:password>            
         </msp:trackingMessageHeader>
      </msp:messageHeader>
   </soapenv:Header>

<!--from here is the same thing as before-->
   <soapenv:Body>
      <bal:CreditRequest>
         <bal:MSISDN>xxxxx</bal:MSISDN>
         <bal:amountToCredit>xxxx</bal:amountToCredit>
         <!--Optional:-->
         <bal:reason>xxxx</bal:reason>
         <bal:transId>xxxx</bal:transId>
      </bal:CreditRequest>
   </soapenv:Body>
</soapenv:Envelope>

当我尝试在Java上使用Web服务时,真正的痛苦开始了。 Eclipse CXF 2.7.9。该工具将毫无问题地导入已安装bot的wsdl版本,但是调用它们的方法是没有用的,因为它们很不错。

creditResponse = balanceManager.getBalanceManagement()。applyCredit(creditRequest,authHeader);

JAVA错误:未为类型BalanceManagement定义方法credit(CreditRequest,MessageHeader)。真的吗您已经知道这将要发生。

所以...

  • 我试图手动编辑@WebMethod条目以包括缺少的功能。那失败了。
  • 我尝试(数小时)创建了本地版本的uglySoap.wsdl,包括缺少的标头,然后将其导入Java,但是它引发了隐秘的org.apache.cxf.interceptor.ClientFaultConverter.processFaultDetail错误。
  • 我什至试图切换到Axis,都无济于事。
  • [请问,对于Java,有什么解决方案可以像SOAP UI一样打孔我的SOAP请求,URL,并以.XML文件(甚至是纯文本格式,没有问题!)获得响应?

谢谢!

由于其他人使用Apache Axis版本1.4创建了格式错误的WSDL定义,因此我很难创建WSDL客户端。让我向您展示我要执行的步骤:首先,我...

java web-services soap wsdl cxf
1个回答
0
投票

[伙计们,我找到了一个可行的解决方案来手动提出请求。

© www.soinside.com 2019 - 2024. All rights reserved.