1
我有有一個方法用2個PARAMS服務的方法:JAXB解組的XML文檔anytype類型
public int ReadXmlDocAsString(@WebParam(name = "password") String password,
@WebParam(name = "doc") com.vincari.hl7.jaxws.xmlDoc<Object> doc){
}
我xmlDoc中類如下:
public class xmlDoc<T> {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<T> content;
public List<T> getContent() {
if (content == null) {
content = new ArrayList<T>();
}
return this.content;
}
public void setContent() {
content = this.content;
}
}
和我的樣品皁要求是:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sample="http://sample.vincari.com/">
<soap:Header/>
<soap:Body>
<sample:ReadXmlDocAsString>
<!--Optional:-->
<password>1234</password>
<!--Zero or more repetitions:-->
<doc>
<Header Application="SourceApp">
<CustomerData>
<Customer AccountNumber="1234" customername="ABCD">
</Customer>
<CustomerData>
</Header>
</doc>
</sample:InsertPatientInfoImpl>
</soap:Body>
</soap:Envelope>
我能夠使用cxf部署webservice。但是當我嘗試映射doc對象並嘗試將其作爲字符串獲取時。我用toString並嘗試使用DOMSource進行轉換。我怎樣才能將其轉換爲字符串。任何幫助非常感謝。