簡體   English   中英

使用 Jax 生成 Proxy web 服務客戶端時出錯

[英]Error when using Jax to generate Proxy web service client

我想知道是否可以在以下問題上獲得一些幫助。

我試圖使用 jax 運行以下命令來生成 web 服務客戶端代理:

wsimport http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

但我收到以下錯誤:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Asher>wsimport http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
parsing WSDL...


[WARNING] src-resolve.4.2: Error resolving component 's:schema'. It was detected that 's:schema' is in namespace 'http:/
/www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'http://www.h
olidaywebservice.com/Holidays/HolidayService.asmx?WSDL#types?schema1'. If this is the incorrect namespace, perhaps the p
refix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be ad
ded to 'http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL#types?schema1'.
  line 15 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL#types?schema1

[ERROR] undefined element declaration 's:schema'
  line 15 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 36 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 74 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 97 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 120 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 131 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL


C:\Users\Asher>

首先我做錯了什么? 最后,如果無法生成代理客戶端,那么還有其他方法可以訪問此 Web 服務及其在 java 中的方法。 我是 java 的新手,所以任何幫助將不勝感激。

謝謝

您可以將 XMLschema 作為參數傳遞給 wsimport

wsimport -b  http://www.w3.org/2001/XMLSchema.xsd  http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

架構的架構中存在潛在的名稱沖突。 一種解決方法是使用以下內容創建customization.xjb

<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" version="2.0">
<globalBindings>
<xjc:simple/>
</globalBindings>
<bindings scd="~xsd:complexType">
<class name="ComplexTypeType"/>
</bindings>
<bindings scd="~xsd:simpleType">
<class name="SimpleTypeType"/>
</bindings>
<bindings scd="~xsd:group">
<class name="GroupType"/>
</bindings>
<bindings scd="~xsd:attributeGroup">
<class name="AttributeGroupType"/>
</bindings>
<bindings scd="~xsd:element">
<class name="ElementType"/>
</bindings>
<bindings scd="~xsd:attribute">
<class name="attributeType"/>
</bindings>
</bindings>

你的最終決定是

wsimport -b  http://www.w3.org/2001/XMLSchema.xsd -b customization.xjb  http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

您是如何創建 WSDL 的? 您似乎引用了一些未在 WSDL 中導出的數據類型。

編輯
wsdl 引用了一個名為“s”的模式,但找不到,因為它的 URL 是
http://www.w3.org/2001/XMLSchema但應該是
http://www.w3.org/2001/XMLSchema .xsd

更改后,現在它還抱怨http://www.27seconds.com/Holidays/也沒有指向模式。 您需要在 WSDL 的副本中修復所有這些問題,然后對其執行 wsimport。

我還去了 www.holidaywebservice.com 發現有第二個版本: http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx?ZDD3ZCCDA2F13F64EEF566

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM