今天使用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); // 添加參數