簡體   English   中英

使用JAX-RPC客戶端從JAX-WS WebService獲取附件

[英]Get attachments from a JAX-WS WebService with a JAX-RPC Client

當我們從JAX-RPC遷移到JAX-WS時,我正在嘗試調用使用JAX-W / JAXB的WebService。 客戶端本身仍在使用JAX-RPC。 WSDL文件保持不變。

這樣工作正常,因為沒有附件。 附件,它不起作用。 客戶說,沒有。 雖然可以在SOAP-Message中看到它們。

據我所知,JAX-WS確實使用MTOM將二進制數據放入消息中,而JAX-RPC使用MIME。

有可能以某種方式使這個工作?

以下是JAX-RPC消息的外觀:

HTTP/1.1 200 OK
Date: Tue, 21 Dec 2010 15:24:10 GMT
Transfer-Encoding: chunked
Content-Type: multipart/related;boundary="----=_Part_6_5206227.1292945050584";type="text/xml";start="<soapPart>"
SOAPAction: "http://XXX"
X-Powered-By: Servlet/2.5 JSP/2.1

014a
------=_Part_6_5206227.1292945050584
Content-Type: text/xml; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-ID: <soapPart>

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><operationWithAttachments href="cid:operationWithAttachments"/></env:Body></env:Envelope>
0522

------=_Part_6_5206227.1292945050584
Content-Type: multipart/mixed; 
    boundary="----=_Part_5_12763436.1292945050570"
Content-ID: <operationWithAttachments>

------=_Part_5_12763436.1292945050570
Content-Type: application/pdf; name=HelloWorld.pdf
Content-Disposition: attachment; filename=HelloWorld.pdf

%PDF-1.4
%öäüß
1 0 obj
<<
/Type /Catalog
/Version /1.4
/Pages 2 0 R
>>
endobj
2 0 obj
<<
...

這里是新的JAX-WS消息:

HTTP/1.1 200 OK
Date: Tue, 21 Dec 2010 15:23:02 GMT
Transfer-Encoding: chunked
Content-Type: multipart/related;start="<rootpart*07499eba-7835-4fe0-bb07-a04801504fb5@example.jaxws.sun.com>";type="application/xop+xml";boundary="uuid:07499eba-7835-4fe0-bb07-a04801504fb5";start-info="text/xml"
X-Powered-By: Servlet/2.5 JSP/2.1

02ba
--uuid:07499eba-7835-4fe0-bb07-a04801504fb5
Content-Id: <rootpart*07499eba-7835-4fe0-bb07-a04801504fb5@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns6:operationWithAttachments xmlns:ns6="XX" xmlns:ns5="XX" xmlns:ns4="XX" xmlns:ns3="XX" xmlns:ns2="XX" xmlns="XX">
00ba
<Include xmlns="http://www.w3.org/2004/08/xop/include" href="cid:9832a057-f692-4f48-ac7d-4dbd7ce76a74@example.jaxws.sun.com"/></ns6:operationWithAttachments></S:Body></S:Envelope>
0562

--uuid:07499eba-7835-4fe0-bb07-a04801504fb5
Content-Id: <9832a057-f692-4f48-ac7d-4dbd7ce76a74@example.jaxws.sun.com>
Content-Type: multipart/mixed; boundary="----=_Part_4_6279014.1292944982388"
Content-Transfer-Encoding: binary

------=_Part_4_6279014.1292944982388
Content-Type: application/pdf; name=HelloWorld.pdf
Content-Disposition: attachment; filename=HelloWorld.pdf

%PDF-1.4
%öäüß
1 0 obj
<<
/Type /Catalog
/Version /1.4
/Pages 2 0 R
>>
endobj
2 0 obj
<<
...

(我自己刪除了名稱空間,所以這不是問題)

我們的想法是讓它們變得相同。

有沒有人這樣做過?

非常感謝你的幫助

那么AFAIK你不能。 JAXRPC使用Soap With Attachments,JAXWS是更現代的MTOM。 它們略有不同,不兼容。 您可以禁用MTOM,但是您必須找到另一種流式傳輸附件(另一種服務)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM