6

以下是我在为 SOAP 服务生成客户端时尝试使用的 xsd,Eclipse 抛出错误:元素“xs:schema”的前缀“xs”未绑定。

<xs:schema version="1.0" 
           targetNamespace="bdo.com.ph/RemitAPI">
  <xs:element name="CheckServiceResponse" 
              nillable="true" type="xs:string"/>
  <xs:element name="apiRequest" nillable="true" type="tns:APIRequest"/>
  .............................
      <xs:element name="referenceNo" type="xs:string" form="qualified"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema> 

我从网络服务中得到了这个 xsd

4

2 回答 2

10
 xmlns:xs="http://www.w3.org/2001/XMLSchema"  

未在 Schema XSD 中添加。添加它使我继续下一步。

xmlns:tns="http://www.bdo.com.ph/RemitAPI  

XSD 中不存在,尽管它存在于封闭的 WSDL 中。

当从 WSDL 提取 XSD 到本地机器时,XSD 中的命名空间引用不会从 WSDL 中获取,它们需要在 XSD 中声明。

于 2013-01-31T11:15:08.570 回答
2

这主要是因为缺少命名空间声明。

   "<elem "namespace" ..xsi:nil=true.>"

将工作。基本上,XML 验证器需要一个命名空间来验证。

于 2014-08-19T07:30:04.693 回答