从.NET代码调用时,Webservice方法返回空

时间:2013-06-28 13:26:49

标签: c# .net web-services soap wsdl

我正在与客户的网络服务进行一些测试。 WSDL的定义如下:

<xs:element name="CorretoresGeralRequest"> 
    <xs:complexType> 
        <xs:sequence> 
            <xs:element name="codEvPesq" type="xs:long" minOccurs="0"/> 
            <xs:element name="nmeEvPesq" type="xs:string" minOccurs="0"/> 
        </xs:sequence> 
    </xs:complexType> 
</xs:element>
<xs:element name="CorretoresGeralResponse"> 
    <xs:complexType> 
        <xs:sequence> 
            <xs:element name="resultCorretoresGeral" type="tr:ResultCorretoresGeral" minOccurs="0" maxOccurs="unbounded" nillable="true"/> 
        </xs:sequence>
    </xs:complexType> 
</xs:element> 
<xs:complexType name="ResultCorretoresGeral"> 
    <xs:sequence> 
        <xs:element name="corretoresGeral" type="tr:CorretorGeral" minOccurs="0" maxOccurs="unbounded" nillable="true"/> 
        <xs:element name="listCompleta" type="xs:boolean"/> 
    </xs:sequence> 
</xs:complexType> 
<xs:complexType name="CorretorGeral"> 
    <xs:sequence> 
        <xs:element name="codAtiv" type="xs:int" minOccurs="0"/> 
        <xs:element name="dscAtiv" type="xs:string" minOccurs="0"/> 
    </xs:sequence> 
</xs:complexType>

当我使用soapUI调用传递参数的方法时,它会正确返回: enter image description here

但是,当我在项目中为它创建Web引用并通过C#代码调用它时,它会返回一个空数组(ServicoTeste是我为该服务创建的webreferece的名称): enter image description here

ServicoTeste.TransporteClient servico = new ServicoTeste.TransporteClient();
ServicoTeste.CorretoresGeralRequest request = new ServicoTeste.CorretoresGeralRequest();
ServicoTeste.ResultCorretoresGeral[] response;

request.nmeEvPesq = "MAS";
response = servico.CorretoresGeral(request);

关于我做错的任何想法?

谢谢。

0 个答案:

没有答案