我使用cxf开发了一个java soap客户端。这个应用程序在mac上工作正常,我用它包含的jdk v6运行它。我创建的服务,例如上传图像到magento安装,但在这里我将介绍问题。
在Apache Cxf中,我转向了块,以避免“残缺的”xml请求。 现在我体验到这个我的客户端应用程序不会在像ubuntu这样的Linux发行版上运行,因为它是开放的jdk。我通过安装openjdk 7和oracle jdk 7在我的mac上测试了这个并且出现了同样的错误。
尽管如此,我还是把客户端的请求变成了分块,因此上传失败了。
我读过这可能是openjdk和一些xml-libs的问题,但是我找不到关于这个主题的任何非常精确甚至有用的信息。
也许有人可能会帮助我。
提前致谢。
这是请求和回复:
ID: 5 Address: http://dev.magento.com/index.php/api/v2_soap/index/ Encoding: UTF-8 Content-Type: text/xml Headers: {Accept=[*/*], SOAPAction=[""]} Messages: Outbound Message (saved to tmp file): Filename: /var/folders/z6/91v2ntss00s1786v_1_5y2540000gn/T/cxf-tmp-636617/cos5007091721474555391tmp (message truncated to 102400 bytes) Payload: 552f069112dde557bc577735fc4eb8bf 5540 /9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gODAK/9sAQwAGBAUGBQQ -------------------------------------- 14168 [main] INFO org.apache.cxf.services.MagentoService.Mage_Api_Model_Server_Wsi_HandlerPort.Mage_Api_Model_Server_Wsi_HandlerPortType - Inbound Message ---------------------------- ID: 5 Response-Code: 200 Encoding: UTF-8 Content-Type: text/xml; charset=UTF-8 Headers: {Cache-Control=[max-age=31536000], connection=[close], Content-Length=[275], content-type=[text/xml; charset=UTF-8], Date=[Fri, 17 Aug 2012 12:52:16 GMT], Expires=[Sat, 17 Aug 2013 12:52:16 GMT], Server=[Apache], Vary=[Accept-Encoding]} Payload: 102 Ungültiger Bildtyp. --------------------------------------
这是一个跟踪:
javax.xml.ws.soap.SOAPFaultException: unsupported imagetype at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156) at $Proxy28.catalogProductAttributeMediaCreate(Unknown Source) at at.myproject.soap.service.product.media.ProductAttributeMediaServiceImpl.create(ProductAttributeMediaServiceImpl.java:61) at at.myproject.magento.service.sync.product.ProductSyncServiceImpl.updateProduct(ProductSyncServiceImpl.java:275) at at.myproject.magento.service.sync.product.ProductSyncServiceImpl.updateProducts(ProductSyncServiceImpl.java:185) at at.myproject.magento.service.sync.product.ProductSyncServiceImpl.syncronize(ProductSyncServiceImpl.java:145) at at.myproject.magento.scheduler.jobs.ProductSyncJob.execute(ProductSyncJob.java:21) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) Caused by: org.apache.cxf.binding.soap.SoapFault: Ungültiger Bildtyp. at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75) at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46) at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113) at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69) at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1656) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1521) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1429) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:659) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:532) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134) ... 8 more
答案 0 :(得分:1)
我可以通过将这些库添加到我的pom来解决这个问题,
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.1</version>
</dependency>
,在查阅了Apache's CXF的常见问题解答之后。
我使用OS X的最新jdk 6以及新的openjdk7和oracle jdk7来运行我的集成测试。