1

服务页面显示了这一点。

要测试此服务,您需要创建一个客户端并使用它来调用该服务。您可以使用命令行中的 svcutil.exe 工具执行此操作,语法如下:

svcutil.exe http://url/?wsdl

这将生成一个配置文件和一个包含客户端类的代码文件。将这两个文件添加到您的客户端应用程序并使用生成的客户端类来调用服务。例如:

C#

class Test
{
    static void Main()
    {
        SaeServicesClient client = new SaeServicesClient();

        // Use the 'client' variable to call operations on the service.

        // Always close the client.
        client.Close();
    }
}

视觉基础

Class Test
    Shared Sub Main()
        Dim client As SaeServicesClient = New SaeServicesClient()
        ' Use the 'client' variable to call operations on the service.

        ' Always close the client.
        client.Close()
    End Sub
End Class

客户的回应。

Suds ( https://fedorahosted.org/suds/ )  version: 0.4 GA  build: R699-20100913

Service ( SaeService ) tns="http://tempuri.org/"
Prefixes (3)
   ns0 = "http://schemas.datacontract.org/2004/07/ImproveIT.SAE.Services"
   ns1 = "http://schemas.datacontract.org/2004/07/System"
   ns2 = "http://schemas.microsoft.com/2003/10/Serialization/"
Ports (1):
   (BasicHttpBinding_ISaeServices)
      Methods (8):
         GetCliente(xs:anyType claveCliente, )
         GetPedido(xs:anyType clavePedido, )
         GetPedidos()
         GetPedidosCargadosEnPeriodoTiempo(xs:dateTime fechaInicial, xs:dateTime fechaFinal, )
         GetProducto(xs:anyType claveProducto, )
         GetProductos()
         GetVendedor(xs:anyType claveVendedor, )
         IsAlive()
      Types (18):
         ns0:ArrayOfPedidoDTO
         ns0:ArrayOfProductoDTO
         ns0:ClienteDTO
         ns1:Exception
         ns0:GetClienteResponse
         ns0:GetPedidoResponse
         ns0:GetPedidosResponse
         ns0:GetProductoResponse
         ns0:GetProductosResponse
         ns0:GetVendedorResponse
         ns0:PartidaDTO
         ns0:PedidoDTO
         ns0:ProductoDTO
         ns0:Response
         ns0:VendedorDTO
         ns2:char
         ns2:duration
         ns2:guid

代码片段

client = suds.client.Client(url)
client.service.GetVendedor(id)

xml

<wsdl:definitions name="SaeService" targetNamespace="http://tempuri.org/"    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/ soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://192.168.1.200:8450/?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://192.168.1.200:8450/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://192.168.1.200:8450/?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/ImproveIT.SAE.Services"/>
<xsd:import schemaLocation="http://192.168.1.200:8450/?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/System"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ISaeServices_IsAlive_InputMessage">
<wsdl:part name="parameters" element="tns:IsAlive"/>
</wsdl:message>
<wsdl:message name="ISaeServices_IsAlive_OutputMessage">
<wsdl:part name="parameters" element="tns:IsAliveResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetProductos_InputMessage">
<wsdl:part name="parameters" element="tns:GetProductos"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetProductos_OutputMessage">
<wsdl:part name="parameters" element="tns:GetProductosResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetProducto_InputMessage">
<wsdl:part name="parameters" element="tns:GetProducto"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetProducto_OutputMessage">
<wsdl:part name="parameters" element="tns:GetProductoResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetPedidos_InputMessage">
<wsdl:part name="parameters" element="tns:GetPedidos"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetPedidos_OutputMessage">
<wsdl:part name="parameters" element="tns:GetPedidosResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetPedidosCargadosEnPeriodoTiempo_InputMessage">
<wsdl:part name="parameters" element="tns:GetPedidosCargadosEnPeriodoTiempo"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetPedidosCargadosEnPeriodoTiempo_OutputMessage">
<wsdl:part name="parameters" element="tns:GetPedidosCargadosEnPeriodoTiempoResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetPedido_InputMessage">
<wsdl:part name="parameters" element="tns:GetPedido"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetPedido_OutputMessage">
<wsdl:part name="parameters" element="tns:GetPedidoResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetVendedor_InputMessage">
<wsdl:part name="parameters" element="tns:GetVendedor"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetVendedor_OutputMessage">
<wsdl:part name="parameters" element="tns:GetVendedorResponse"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetCliente_InputMessage">
<wsdl:part name="parameters" element="tns:GetCliente"/>
</wsdl:message>
<wsdl:message name="ISaeServices_GetCliente_OutputMessage">
<wsdl:part name="parameters" element="tns:GetClienteResponse"/>
</wsdl:message>
<wsdl:portType name="ISaeServices">
<wsdl:operation name="IsAlive">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/IsAlive" message="tns:ISaeServices_IsAlive_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/IsAliveResponse" message="tns:ISaeServices_IsAlive_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetProductos">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetProductos" message="tns:ISaeServices_GetProductos_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetProductosResponse" message="tns:ISaeServices_GetProductos_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetProducto">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetProducto" message="tns:ISaeServices_GetProducto_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetProductoResponse" message="tns:ISaeServices_GetProducto_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetPedidos">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetPedidos" message="tns:ISaeServices_GetPedidos_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetPedidosResponse" message="tns:ISaeServices_GetPedidos_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetPedidosCargadosEnPeriodoTiempo">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetPedidosCargadosEnPeriodoTiempo" message="tns:ISaeServices_GetPedidosCargadosEnPeriodoTiempo_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetPedidosCargadosEnPeriodoTiempoResponse" message="tns:ISaeServices_GetPedidosCargadosEnPeriodoTiempo_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetPedido">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetPedido" message="tns:ISaeServices_GetPedido_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetPedidoResponse" message="tns:ISaeServices_GetPedido_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetVendedor">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetVendedor" message="tns:ISaeServices_GetVendedor_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetVendedorResponse" message="tns:ISaeServices_GetVendedor_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetCliente">
<wsdl:input wsaw:Action="http://tempuri.org/ISaeServices/GetCliente" message="tns:ISaeServices_GetCliente_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISaeServices/GetClienteResponse" message="tns:ISaeServices_GetCliente_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_ISaeServices" type="tns:ISaeServices">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="IsAlive">
<soap:operation soapAction="http://tempuri.org/ISaeServices/IsAlive" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetProductos">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetProductos" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetProducto">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetProducto" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetPedidos">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetPedidos" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetPedidosCargadosEnPeriodoTiempo">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetPedidosCargadosEnPeriodoTiempo" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetPedido">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetPedido" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetVendedor">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetVendedor" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetCliente">
<soap:operation soapAction="http://tempuri.org/ISaeServices/GetCliente" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SaeService">
<wsdl:port name="BasicHttpBinding_ISaeServices" binding="tns:BasicHttpBinding_ISaeServices">
<soap:address location="http://192.168.1.200:8450/Sae"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

我得到的错误,除了 IsAlive() 之外的所有方法。

suds.WebFault:服务器引发错误:'格式化程序在尝试反序列化消息时抛出异常:尝试反序列化参数http://tempuri.org/:claveProducto时出错。InnerException 消息是“来自命名空间http://tempuri.org/的元素 claveProducto不能将子内容反序列化为对象。请使用 XmlNode[] 反序列化这种 XML 模式。

4

0 回答 0