嗨我想從web服務返回一個列表。我的代碼是在axis2 web服務中返回列表
public class WebListTest {
public List serviceFunction(String arg1,String arg2)
{
List list=new ArrayList();
list.add(arg1);
list.add(arg2);
return list;
}
}
但在WSDL創作,我發現
<xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType"/>
而當從客戶端調用此WebService我得到異常
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Any type element type has not been given
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at webservice1.WebListTestStub.fromOM(WebListTestStub.java:1622)
at webservice1.WebListTestStub.serviceFunction(WebListTestStub.java:191)
at webservice1.ServiceTest.main(ServiceTest.java:24)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Any type element type has not been given
at webservice1.WebListTestStub$ServiceFunctionResponse$Factory.parse(WebListTestStub.java:917)
at webservice1.WebListTestStub.fromOM(WebListTestStub.java:1616)
... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Any type element type has not been given
at org.apache.axis2.databinding.utils.ConverterUtil.getAnyTypeObject(ConverterUtil.java:1612)
at webservice1.WebListTestStub$ServiceFunctionResponse$Factory.parse(WebListTestStub.java:895)
... 3 more
現在我do.please幫助。
它無法投射到數組。其顯示錯誤。花花公子。 – Krishna
不知道爲什麼,爲我工作。也許更改不同的版本? – Wrench
不要因爲Arraylist無法投射到String數組中。 bcoz其實你不能使用集合類,因爲它不支持SOAP服務。我們必須使用數組或字符串數據類型 – Krishna