2017-01-25 96 views
0

我確定這只是試點錯誤,但找不到解決方案。使用包含附件的肥皂負載操作來安裝jax-ws Web服務。這是模式文檔的一個片段。這是定義的類型:此元素定義嵌入式MTOM附件在SOAP有效載荷中編碼兩次

<xs:complexType name="BinaryAttachmentType"> 
      <xs:simpleContent> 
       <xs:restriction base="xmime:base64Binary"> 
       <xs:attribute ref="xmime:contentType" use="required" /> 
       </xs:restriction> 
      </xs:simpleContent> 
    </xs:complexType> 

<xs:element name="Contact"> 
    <xs:complexType> 
     <xs:sequence> 
      <!-- removed other elements --> 
      <xs:element name="Attachment" type="BinaryAttachmentType" minOccurs="0" maxOccurs="1"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:element 

使用的soapUI,SOAP是這樣的:

<hsn:Contact> 
    <!-- other elements --> 
     <hsn:Attachment xm:contentType="image/jpeg">cid:323665198529</hsn:Attachment> 
</hsn:Contact> 

在soapUI的附加文件: enter image description here 當我看看日誌中的http:

HTTP標頭:

"Content-Type: multipart/related; type="text/xml"; start="<[email protected]>"; boundary="----=_Part_15_23791896.1485382707426"" 
"SOAPAction: "http://hsn.us.banner.hsntech.com/Level1Request"" 
"MIME-Version: 1.0" 
"Content-Length: 104164" 
"Host: localhost:7001" 
"User-Agent: Apache-HttpClient/4.1.1 (java 1.5)" 
"------=_Part_15_23791896.1485382707426" 
"Content-Type: text/xml; charset=UTF-8" 
"Content-Transfer-Encoding: 8bit" 
"Content-ID: <[email protected]>" 
在SOAP主體

,看到base64編碼文件附件元件:再次

<hsn:AttachmentFileName>test1.jpg</hsn:AttachmentFileName> 
     <hsn:Attachment xm:contentType="image/jpeg">/9j/4AAQSkZJRgABAQEAYABgAAD .. rest of base64 encoding 

然後SOAP消息之後,編碼的附件:

------=_Part_15_23791896.1485382707426 
    Content-Type: image/jpeg; 
    name=Foo.jpg 
    Content-Transfer-Encoding: binary 
    Content-ID: <Foo.jpg> 
    Content-Disposition: attachment; name=Foo.jpg; filename=Foo.jpg 

    (... encoded attachment again) 
[0xff][0xd8][0xff][0xe0][0x0][0x10]JFIF[0x0][0x1][0x1][0x1][0x0]`[0x0]`[0x0][0x0][0xff][0xdb][0x0]C[0x0][\n] 

那麼,爲什麼該文件在請求中編碼了兩次?謝謝。

回答

1

檢查啓用MTOM被設置爲在請求屬性

Request Properties