我這裏有一個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
當您嘗試執行wsdl2java時,能否請您從日誌中分享您的錯誤?沒有更多信息,社區將無法提供幫助。 – derdc
似乎文件ContirbutorSummaryService_1_2.xsd不在它必須位於的位置。 – Omar
@kapildas - 多一個請求。 「WSDLRuntimeException:FAIL_TO_CREATE_WSDL_DEFINITION」本身並不是很多,我可以明白爲什麼你最初沒有發佈它。你能再運行一次「wsdl2java -impl ContributorSummaryService_1.wsdl -verbose」嗎? – derdc