简体   繁体   中英

To test this service using svcutil.exe

I want to test a service with svcutil.exe. The step is

svcutil.exe http://11.55.99.341/MessagingServices/MessageData.svc?wsdl

I found that there is a cs file was generated in C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin.

Some of code is likely as:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.5466
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MessagingAPI.Objects
{
using System.Runtime.Serialization;


[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="InboxDTO", Namespace="http://schemas.datacontract.org/2004/07/MessagingAPI.Objects")]
public partial class InboxDTO : object, System.Runtime.Serialization.IExtensibleDataObject
{

    private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

    private System.Guid[] FullInboxField;

    private System.Guid InmateIdField;

    private int MessagesInWaitField;

    private int ReadMessagesField;

    private System.Guid[] UnreadInboxField;

    private int UnreadMessagesField;

    public System.Runtime.Serialization.ExtensionDataObject ExtensionData
    {
        get
        {
            return this.extensionDataField;
        }
        set
        {
            this.extensionDataField = value;
        }
    }

    [System.Runtime.Serialization.DataMemberAttribute()]
    public System.Guid[] FullInbox
    {
        get
        {
            return this.FullInboxField;
        }
        set
        {
            this.FullInboxField = value;
        }
    }

I am not sure how to test it with this service with the code then?

You would either need to create an application that consumes this generated class -or- use the WcfTestClient application included with Visual Studio (which can be opened with the Visual Studio Command Prompt or can typically be found under C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE [depending on your version of Visual Studio]).

See: http://msdn.microsoft.com/en-us/library/bb552364.aspx

wgraham,'s answer is correct. To use the WcfTestClient

  1. Open C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\WcfTestClient.exe
  2. File --> Add Service
  3. Enter http://11.55.99.341/MessagingServices/MessageData.svc

当您使用服务URL运行svcutil.exe时,它将为您提供代理类和配置文件,您可以在Windows / Web应用程序中添加类和配置文件,并创建代理类的对象并开始使用公开的方法作为服务的一部分。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM