2013-12-09 54 views
0

我這裏有一個WSDL文件和服務是婉轉不起來,所以我想從WSDL文件從WSDL我們可以生成Java文件

我們可以生成從WSDL文件的Java文件做一個模擬的服務?我試圖贏得WSDL2Java的CXF但它說錯誤

無法創建WSDL_definition

C:\Users\malnassar\Desktop\cxf3\apache-cxf-3.0.0-milestone1\bin>wsdl2java -impl ContributorSummaryService_1.wsdl 

WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: FAIL_TO_CREATE_WSDL_DEFINITION 


C:\Users\malnassar\Desktop\cxf3\apache-cxf-3.0.0-milestone1\bin>wsdl2java ContributorSummaryService_1.wsdl 

WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: FAIL_TO_CREATE_WSDL_DEFINITION 


C:\Users\malnassar\Desktop\cxf3\apache-cxf-3.0.0-milestone1\bin>wsdl2java ContributorSummaryService_1.wsdl 

WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: FAIL_TO_CREATE_WSDL_DEFINITION 


C:\Users\malnassar\Desktop\cxf3\apache-cxf-3.0.0-milestone1\bin> 

,並與axis1.6 WSDL2Java的試了一下它與 文件未發現異常結束

C:\Users\malnassar\Desktop\axis2-1.6.2\bin>wsdl2java.bat -uri ContributorSummaryService_1.wsdl -o c:\WebService\ -uw

原木

使用

AXIS2_HOME: C:\Users\malnassar\Desktop\axis2-1.6.2 Using JAVA_HOME: C:\Program Files (x86)\Java\jdk1.6.0_33 Retrieving document at 'ContributorSummaryService_1.wsdl'. Retrieving schema at 'ContributorSummaryService_1_2.xsd', relative to 'file:/C:/Users/malnassar/Desktop/axis2-1.6.2/bin/ContributorSummaryService_1.wsdl'. log4j:WARN No appenders could be found for logger (org.apache.axis2.i18n.ProjectResourceBundle). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:178) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'ContributorSummaryServ ice_1_2.xsd', relative to 'file:/C:/Users/malnassar/Desktop/axis2-1.6.2/bin/ContributorSummaryService_1.wsdl'.: java.io.FileNotFoundException: This file was not found: file:/C:/Users/malnassar/Desktop /axis2-1.6.2/bin/ContributorSummaryService_1_2.xsd at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(CodeGenerationEngine.java:320) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:133) ... 2 more Caused by: java.io.FileNotFoundException: This file was not found: file:/C:/Users/malnassar/Desktop/axis2-1.6.2/bin/ContributorSummaryService_1_2.xsd at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 13 more C:\Users\malnassar\Desktop\axis2-1.6.2\bin>

3。嘗試使用SOAPUI創建項目時出現以下錯誤

Error loading [file:\C:\Users\kpane\Desktop\ContributorSummaryService.xsd]: java.io.FileNotFoundException: C:\Users\kpane\Desktop\ContributorSummaryService.xsd (The system cannot find the file specified

+1

當您嘗試執行wsdl2java時,能否請您從日誌中分享您的錯誤?沒有更多信息,社區將無法提供幫助。 – derdc

+1

似乎文件ContirbutorSummaryService_1_2.xsd不在它必須位於的位置。 – Omar

+0

@kapildas - 多一個請求。 「WSDLRuntimeException:FAIL_TO_CREATE_WSDL_DEFINITION」本身並不是很多,我可以明白爲什麼你最初沒有發佈它。你能再運行一次「wsdl2java -impl ContributorSummaryService_1.wsdl -verbose」嗎? – derdc

回答

2

如果要模擬和使用Web服務,請嘗試使用soapui。 souapui.org

懲戒使用了SoapUI Web服務:http://www.soapui.org/Getting-Started/mock-services.html

對於使用WSDL生成CLASSE,JDK已經建成wsimport工具來做到這一點。試一試。

+0

@ Kumar我不想使用客戶端 –

+0

我用SOAPUI打開時發佈了錯誤 –

+0

如果你想模擬你的web服務,SoapUI是一個完美的選擇。 http://www.soapui.org/Getting-Started/mock-services.html。關於文件未找到異常,請確保您在放置wsdl文件的同一文件夾中有ContributorSummaryService.xsd文件。您的Web服務提供商應該能夠提供該文件。 –