Unmarshalling Error: 意外的元素的問題的解決


今天使用axis2進行webservice調用出現上述問題,網絡上沒有找到解決的方案,后自己解決了,特此登記。

原因:傳輸參數格式有問題。

解決:將以下刪除線的內容替換成字體加粗的內容。

OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://hr.evecom.net/", "");// 參數1(uri)=即為wsdl文檔的targetNamespace;參數2(prefix)=可不填
OMElement method = fac.createOMElement("hiMyService", omNs);// 方法名

OMElement in0 = fac.createOMElement("content", omNs);// 方法參數

QName qname = new QName("content");
OMElement in0 = fac.createOMElement(qname);// 方法參數
in0.setText(xmlStr); // 參數值
method.addChild(in0); // 添加參數


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM