2017-02-28 41 views
1

WSDL的部分:當wsdl文件生成時如何獲取字節數組?

<complexType name="Example"> 
        <sequence> 
         <element maxOccurs="unbounded" minOccurs="0" name="base64bytes" type="xsd:byte"/> 
         <element name="fileName" nillable="true" type="xsd:string"/> 
        </sequence> 
       </complexType> 

後一代與JAXWS-Maven的插件intellijIDEA:

@XmlElement(name = "base64bytes", type = Byte.class) 
    protected List<Byte> base64Bytes; 

我應該如何改變我的WSDL文件或WS,我得到的字節數組,而不是字節的名單後,世代?

回答

0

你應該試試這個:

xsd:base64Binary

,而不是xsd:byte。 類型xsd:base64Binary將二進制數據表示爲二進制八位字節序列,因此它將作爲字節數組生成。

此外,您應該刪除maxOccurs="unbounded",因爲此屬性會生成一個字節數組列表。

+0

使用本次交易對其進行修改 @XmlElement(name =「base64bytes」) protected List base64Bytes; – Porty

+0

我認爲你不需要maxOccurs =「unbounded」屬性,你應該刪除它。 – user6904265

+0

感謝你的工作!) – Porty