scalaxb需要缺少类型

时间:2016-10-27 17:36:59

标签: xml scala xsd wsdl scalaxb

我正在尝试使用scalaxb从两个wsdl文件生成Web服务。 以下是文件:https://services.pwsdemo.com/WSDL/PwsDemo_creditcardtransactionservice.xml https://services.pwsdemo.com/WSDL/PwsDemo_creditcardmanagementservice.xml
我将它下载到我的本地机器并运行以下命令:
$ scalaxb PwsDemo_creditcardmanagementservice.xml PwsDemo_creditcardtransactionservice.xml -p delta

我收到了错误:
Referenced type {http://schemas.datacontract.org/2004/07/ThreeDelta.Web.Services.ECLinx.Definitions}ClientCredentials was not found.

我的代码中有一个ClientCredentials类,它非常简单:

class Halo_3Delta_Request_ClientCredentials
{
    protected $ClientCode;
    protected $UserName;
    protected $Password;

    public function __construct($clientCode, $username, $password)
    {
        $this->ClientCode = $clientCode;
        $this->UserName = $username;
        $this->Password = $password;
    }
}

提供缺失类型的好方法是什么?

更新
我找到了wsdl文件中已存在的这种类型定义:

  <xs:complexType name="ClientCredentials">
    <xs:sequence>
      <xs:element minOccurs="0" name="ClientCode" nillable="true" type="xs:string"/>
      <xs:element minOccurs="0" name="Password" nillable="true" type="xs:string"/>
      <xs:element minOccurs="0" name="UserName" nillable="true" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

所以我想现在的问题是如何重新排列这些文件,以便通过验证。

1 个答案:

答案 0 :(得分:0)

错误仅仅是XML结构 以下是重新排列的两个文件,以便scalaxb可以解析它们:

PwsDemo_creditcardmanagementservice.xml

PwsDemo_creditcardtransactionservice.xml