1

サービスのページはこれを示しています。

このサービスをテストするには、クライアントを作成し、それを使用してサービスを呼び出す必要があります。これは、コマンド ラインから次の構文で svcutil.exe ツールを使用して行うことができます。

svcutil.exe http://url/?wsdl

これにより、クライアント クラスを含む構成ファイルとコード ファイルが生成されます。2 つのファイルをクライアント アプリケーションに追加し、生成されたクライアント クラスを使用してサービスを呼び出します。例えば:

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 は、オブジェクトとして逆シリアル化される子コンテンツを持つことはできません」でした。このパターンの XML を逆シリアル化するには、XmlNode[] を使用してください。

4

0 に答える 0