2011-11-12 44 views
1
public ArrayList myFunc(string arg1, string arg2) 

我已经在浏览器上测试过该方法,并且工作正常。 在客户端,我做这个检索myFunc的返回值:无法从Web服务检索字符串数组

string[] ret = ws.myFunc("arg1", "arg2"); 

问题是沤总是包含任何虽然当浏览器的测试我收到此

<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"> 
    <anyType xsi:type="xsd:string">str01</anyType> 
    <anyType xsi:type="xsd:string">str02</anyType> 
</ArrayOfAnyType> 

我失去了一些东西?谢谢!

+0

当您添加Web引用时,设计者生成的代理类中的myFunc签名是什么?我不认为你可以把ArrayList当成字符串数组...你需要确认代理类中的方法签名.. – xgencoder

+0

它是字符串[] myFunc(字符串arg1,字符串arg2) – Wayne

+0

你检查了长度调用web方法后的数组?它会返回任何东西吗? – xgencoder

回答

0

您是否尝试过 -

List<string> ret = ws.myFunc("arg1", "arg2"); 

从网上服务回报可以在ArrayOfString形式。