Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#SOAP复杂类型参数_C#_Wsdl_Nusoap - Fatal编程技术网

C#SOAP复杂类型参数

C#SOAP复杂类型参数,c#,wsdl,nusoap,C#,Wsdl,Nusoap,我正在使用C#开发一个SOAP客户端,使用我在PHP中使用NuSoap公开的服务。从消费的角度来看,我的web服务工作得很好,但我遇到的麻烦与将复杂类型作为参数传递有关 使用方法返回的复杂类型并不麻烦,但我似乎不知道如何在C#中实际操作我的复杂类型 除非有人真的请求它,否则我暂时不使用冗长的WSDL。但是我尝试使用的复杂类型是另一个复杂类型的列表。在我的C#应用程序中,我需要做的是从列表中添加和删除项目,但我似乎不知道该怎么做 谁能给我指一下正确的方向吗?可根据要求提供更多信息。因此,我是这样理

我正在使用C#开发一个SOAP客户端,使用我在PHP中使用NuSoap公开的服务。从消费的角度来看,我的web服务工作得很好,但我遇到的麻烦与将复杂类型作为参数传递有关

使用方法返回的复杂类型并不麻烦,但我似乎不知道如何在C#中实际操作我的复杂类型

除非有人真的请求它,否则我暂时不使用冗长的WSDL。但是我尝试使用的复杂类型是另一个复杂类型的列表。在我的C#应用程序中,我需要做的是从列表中添加和删除项目,但我似乎不知道该怎么做


谁能给我指一下正确的方向吗?可根据要求提供更多信息。

因此,我是这样理解的:

//instantiate proxy

var commandList = getCommands(authToken);

//build an array of new commands

var commands = new [] { new Command { id = "SomeID", command = "SomeCommand" } /*, etc.*/ } };

//assign commands to your list

commandList.Commands = commands;

//do something with the commandList object
如果要在Visual Studio中生成代理,可以选择将数组转换为强类型列表对象(添加服务引用->高级->集合类型:System.Collections.Generic.List)。这样,您就可以调用commandList.Add()


另外,我不知道为什么从getCommands()返回的类型的名称是List。

您不确定如何实际使用为您生成的C#SOAP客户端吗

像这样的东西应该有用

// Edit an existing file command.
using (var client = new mysiteServicePortTypeClient()) {
    string auth = client.doAuth("user", "pass");
    List l = client.getCommands(auth); // get all of the Command[] arrays
    Command file = l.files[0]; // edit the first Command in the "files" array (will crash if Length == 0, of course
    file.command = "new command"; // since the Command is in the array, this property change will stick
    client.submitResults(auth, l); // send back the same arrays we received, with one altered Command instance
}

[Edit]正如Nicholas在回答中推断的那样,您的SOAP服务定义应该避免使用常见的类型名称,如“List”因为如果您在WSDL上运行svcutil.exe,它将与
System.Collections.Generic.List

冲突--您能发布它生成的相关包装吗?实际上您刚刚给了我一个我认为需要的面包屑。让我实际处理这个输出,看看我是否能得到我需要的。好吧,我放弃。我把.cs甩在了