Webservice call error (unexpected element (uri:"", local:"billType")) solution

Help my colleagues to look at the Webservice call problem. After searching online for a long time, only the problem has not actually solved the answer. The error is as follows:

Unmarshalling Error: unexpected element (uri:"", local:"billType"). Expected elements are <{http://alms.acconsys.com/types/message/A4Interface/SendbillInfosToALMS}billStatus>

 

Compared with the soapui tool, it is finally found that it is because there is no namespace for the passed parameters. The solution is as follows:

Error code:

QName ename = new QName(ns, "SendbillInfosToALMSRequest","com");
SOAPBodyElement ele = body.addBodyElement(ename);
  
// pass parameters  
ele.addChildElement("billType").setValue("aaa");    
ele.addChildElement("billStatus").setValue("path");    
ele.addChildElement("billNum").setValue("path");

 

 

Add namespace (solve):

QName ename = new QName(ns, "SendbillInfosToALMSRequest","com");
SOAPBodyElement ele = body.addBodyElement(ename);  
ele.addChildElement("billType", "sen", "http://alms.acconsys.com/types/message/A4Interface/SendbillInfosToALMS").setValue("1");
ele.addChildElement("billStatus", "sen", "http://alms.acconsys.com/types/message/A4Interface/SendbillInfosToALMS").setValue("2");
ele.addChildElement("billNum", "sen", "http://alms.acconsys.com/types/message/A4Interface/SendbillInfosToALMS").setValue("3");

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327036867&siteId=291194637