To test this service using svcutil.exe

I want to check the service using svcutil.exe. Step

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

I found that a cs file was created in C: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Bin.

Some code is likely to be as follows:

 //------------------------------------------------------------------------------ // <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'm not sure how to test it using this service with code?

+6
source share
3 answers

You will need to either create an application that uses this generated class, or use the WcfTestClient application included in Visual Studio (which can be opened using the Visual Studio command line or can usually be found in the C: \ Program Files (x86) \ Microsoft Visual Studio folder 10.0 \ Common7 \ IDE [depending on your version of Visual Studio]).

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

+5
source

wgraham, the answer is correct. To use WcfTestClient

  • Open C: \ Program Files (x86) \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ WcfTestClient.exe
  • File โ†’ Add Service
  • Enter http://11.55.99.341/MessagingServices/MessageData.svc
+3
source

when you run svcutil.exe with the service url, it will give you the proxy class and configuration file, you can add the class and configuration file to the window / web application and create a proxy class object and start using the methods exposed as part service.

+1
source

Source: https://habr.com/ru/post/945623/


All Articles