0

我正在使用Eclipse中的Apache Axis2(1.6.2)生成Webservice客戶端代碼。在Eclipse中使用Apache Axis2 XMLBeans生成SOAP webservice客戶端代碼

我正在使用Axis2 eclipse插件來生成客戶端代碼。 我可以用ADB數據綁定方法然而,當我嘗試使用XMLBean的數據綁定方法,我得到異常下面生成客戶端代碼:

Exception occurred during code generation for WSDL : org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 
java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.eclipse.jst.ws.axis2.consumption.core.command.Axis2ClientCodegenCommand.execute(Axis2ClientCodegenCommand.java:222) 
at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419) 
at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359) 
at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254) 
at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294) 
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464) 
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372) 
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1029) 
at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264) 
at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91) 
at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.performFinish(WizardPageManager.java:262) 
at org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard.performFinish(DynamicWizard.java:382) 
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827) 
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432) 
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) 
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240) 
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4128) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465) 
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270) 
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3974) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3613) 
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) 
at org.eclipse.jface.window.Window.open(Window.java:801) 
at org.eclipse.wst.command.internal.env.ui.widgets.popup.DynamicPopupWizard.run(DynamicPopupWizard.java:130) 
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) 
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) 
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) 
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) 
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4128) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465) 
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270) 
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3974) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3613) 
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) 
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) 
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) 
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) 
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) 
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) 
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) 
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) 
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) 
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) 
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) 
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) 
at org.eclipse.equinox.launcher.Main.run(Main.java:1410) 
Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293) 
... 63 more 
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 
at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:126) 
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:246) 
... 63 more 
Caused by: java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:115) 
... 64 more 
Caused by: java.lang.RuntimeException: org.apache.xmlbeans.XmlException: error: Imported schema has a target namespace "null" that does not match the specified "" 
at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:325) 
... 69 more 
Caused by: org.apache.xmlbeans.XmlException: error: Imported schema has a target namespace "null" that does not match the specified "" 
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667) 
at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:189) 
... 69 more 

注:我收到的時候我嘗試使用命令行來生成代碼相同的錯誤論據。客戶端代碼與ADB數據綁定完美配合。

我能夠使用XMLBean數據綁定方法使用Axis1生成cline代碼,但是我想使用Axis2。

你的幫助是非常讚賞。

回答

0

問題在於WSDL文件,在修改了WSDL和XSD文件的Targetnamespace之後,所有工作都正常。 我認爲XMLBean需要以特定的方式定義WSDL。謝謝!!

相關問題