我正在使用cxf 2.7.7並使用HTOM與https ...並且它與cxf java客戶端正常工作。 但是,當我通過SOAP UI客戶端發送消息,並在服務器端(在我的端點實現類中)嘗試訪問Datahandler對象的任何方法時(請參閱下面的縮略代碼),然後獲得java.lang。 org.apache.cxf.attachment.LazyDataSource中的NullPointerException。請注意,對任何.getXXX方法的調用都會產生異常(這些調用將轉換爲相應的LazyDataSource.getXXX方法的調用,並且看起來像LazyDataSource爲空) 當我通過java客戶端發送請求時,不會發生這種情況。當我使用SOAPUI用於請求 @WebService只發生(的targetNamespace = 「http://webservice.dcca.dell.com」, PORTNAME = 「ObjectMTOMService」,服務名= 「ObjectMTOMServiceService」) 公共類ObjectMTOMServiceImpl實現ObjectMTOMService {org.apache.cxf.attachment.LazyDataSource.getInputStream中的java.lang.NullPointerException
@Resource
WebServiceContext wsContext;
public ObjectStoreResp uploadObject(ObjectStoreReq objectReqParam) {
DataHandler objHandler = objectReqParam.getObjData();
try {
if (objHandler != null)
{
String objName=objHandler.getName();
String contentType=objHandler.getContentType();
InputStream iStream= objHandler.getDataSource().getInputStream();
}
catch (Exception e) {
e.printStackTrace();
respParam.setRespCode(-1);
return (respParam);
}
}
我看到的例外是如下
java.lang.NullPointerException
at org.apache.cxf.attachment.LazyDataSource.getName(LazyDataSource.java:73)
at javax.activation.DataHandler.getName(DataHandler.java:191)
at com.dell.dcca.webservice.objectmtomservice.ObjectMTOMServiceImpl.uploadObject(ObjectMTOMServiceImpl.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
........ <<< removed lot of stack trace for brevity >>>
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1555)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
java.lang.NullPointerException
即SOAPUI發如下:< <我已經接近這一消息 - 複製和SOAPUI日誌粘貼>>
POST https://160.110.73.35:8443/ObjectMTOMService/services/ObjectMTOMService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="application/xop+xml"; start="<[email protected]>"; start-info="text/xml"; boundary="----=_Part_13_756617.1389959552144"
SOAPAction: "http://InteropBaseAddress/interop/header"
MIME-Version: 1.0
Content-Length: 5432
Host: 160.110.73.35:8443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
------=_Part_13_756617.1389959552144"
"Content-Type: application/octet-stream; name=InfantHealthcare.jpg"
Content-Transfer-Encoding: binary
Content-ID: <images.jpg>
Content-Disposition: attachment; name="images.jpg"; filename="InfantHealthcare.jpg
<< file contents ... >>
歡迎任何輸入。 如果有人試圖用MTOM客戶SOAPUI和Axis 2.7.X起組合,讓我知道
由於一噸的幫助
約傑什