我正在使用STS(Spring Tool Suite)IDE,Tomcat 7,Spring 4 with Rest(@RestController),JDK 7和使用Maven项目。 我正在调用Axis2 WebService,为此我通过传递WSDLLocation URL使用WSDL2Java工具生成了Axis2 Client。然后生成了一个Stub(Client)类,我正在尝试检索" catgoryType"来自Axis2服务的元素,但我收到错误,这里是例外日志: -
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement categoryType
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at com.webservice.client.ProductIdentity_7_0Stub.fromOM(ProductIdentity_7_0Stub.java:3085)
at com.webservice.client.ProductIdentity_7_0Stub.findProduct(ProductIdentity_7_0Stub.java:1122)
at com.webservice.client.SOAPConsumer.getInfo(SOAPConsumer.java:125)
at com.controller.restcontroller.v1.PINDetailsRestController.getPINResult(PINDetailsRestController.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement categoryType
at com.webservice.client.ProductIdentity_7_0Stub$ProduceableCategoryIdentifier$Factory.parse(ProductIdentity_7_0Stub.java:65481)
at com.webservice.client.ProductIdentity_7_0Stub$Component$Factory.parse(ProductIdentity_7_0Stub.java:38761)
at com.webservice.client.ProductIdentity_7_0Stub$Product$Factory.parse(ProductIdentity_7_0Stub.java:31880)
at com.webservice.client.ProductIdentity_7_0Stub$FindProductOP$Factory.parse(ProductIdentity_7_0Stub.java:56244)
at com..webservice.client.ProductIdentity_7_0Stub$FindProductResponse$Factory.parse(ProductIdentity_7_0Stub.java:44992)
at com.webservice.client.ProductIdentity_7_0Stub$FindProductResponseE$Factory.parse(ProductIdentity_7_0Stub.java:26859)
at com.webservice.client.ProductIdentity_7_0Stub.fromOM(ProductIdentity_7_0Stub.java:2986)
... 40 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement categoryType
at com.webservice.client.ProductIdentity_7_0Stub$ProduceableCategoryIdentifier$Factory.parse(ProductIdentity_7_0Stub.java:65407)
... 46 more
2015-12-03 12:17:31 FATAL SOAPConsumer:133 - Some Error happened due to Axis2 Client
根据我的观察,在调用Axis2服务的XSD中,元素名称是" catgoryType" 但在我的应用程序中,在生成的Stub(Client)类中,元素名称是" localCategoryType"。所以我的问题是如何在Calling Axis2服务中使用XSD元素映射生成的Stub类Element?
谢谢,