2012-01-04 75 views
1

我正在嘗試使用wsdl2java(由maven axistools包裝)生成一個帶有軸的Java客戶端。axis wsdl2java無法讀取具有特殊字符的架構

我下載了wsdl和相應的模式。

的WSDL具有下列模式定義:

<wsdl:types> 
<xsd:schema 
    targetNamespace="http://example.com/CM_IntegrationService/" 
    xmlns:pref="http://example.com/CM_IntegrationService" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <xsd:import namespace="http://example.com//CM_IntegrationService" 
     schemaLocation="CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd"/> 

簡而言之:

schemaLocation="CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd"

錯誤顯示爲:

[ERROR] Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (default) on project wsclient-cm: Error generating Java code from WSDL. error running file:/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService.wsdl:

WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd', relative to 'file:/C:/workspace/ws/wsclient-reactor/shop-wsclient-wsdl/src/main/wsdl/CM_IntegrationService.wsdl'.:

This file was not found: file:/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd -> [Help 1]

總之文件沒有發現:

/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd

有沒有辦法指定要使用哪個模式?我將模式保存爲ServiceModel_CM_IntegrationService.xsd。然而,它搜索完整路徑,包括我在文件系統上無法模擬的=?

我不想修改WSDL中建議:WSDL to Java -client creation error

Why is axistools-maven-plugin trying to access this relative schema location?類似於但使用useEmitter=true選項並沒有幫助。

回答

1

如果不修改WSDL,這當前是不可能的。如果在不修改WSDL的情況下執行此操作(順便說一句,爲什麼你不想這麼做?)需要支持XML目錄,如AXIS-1984中所述。

+0

這個想法是直接下載文件並使用maven啓動服務生成。手動交互應保持在最低限度,以避免錯誤來源。可以避免的步驟不會產生錯誤。感謝您的鏈接。 – 2012-01-05 11:12:04

+0

那你爲什麼不直接把HTTP URL提供給wsdl2java? – 2012-01-05 11:52:37

+0

也考慮到了這一點。然而,帶有web服務的服務器並不總是在運行,它並不總是運行最新版本。 – 2012-01-05 12:02:34