From 69b2607d285e1833042cd05f9624666dc69be803 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sat, 5 May 2018 15:59:53 +0200 Subject: [PATCH] add excercise about services --- .../2018-05-05-services.sln | 25 +++ .../2018-05-05-services.csproj | 139 ++++++++++++ .../2018-05-05-services/FirstService.svc | 1 + .../2018-05-05-services/FirstService.svc.cs | 27 +++ .../2018-05-05-services/Global.asax | 1 + .../2018-05-05-services/Global.asax.cs | 16 ++ .../2018-05-05-services/IFirstService.cs | 18 ++ .../2018-05-05-services/Person.cs | 13 ++ .../Properties/AssemblyInfo.cs | 35 +++ .../2018-05-05-services/Web.Debug.config | 30 +++ .../2018-05-05-services/Web.Release.config | 31 +++ .../2018-05-05-services/Web.config | 35 +++ .../2018-05-05-services/packages.config | 5 + .../2018-05-05_service-client.sln | 25 +++ .../2018-05-05_service-client.csproj | 19 ++ .../TestService/ConnectedService.json | 24 +++ .../TestService/Reference.cs | 127 +++++++++++ .../2018-05-05_service-client/Program.cs | 14 ++ oop/WpfApp1/WpfApp1.sln | 25 +++ oop/WpfApp1/WpfApp1/App.config | 18 ++ oop/WpfApp1/WpfApp1/App.xaml | 9 + oop/WpfApp1/WpfApp1/App.xaml.cs | 17 ++ .../TestService/FirstService.wsdl | 89 ++++++++ .../TestService/Reference.cs | 60 ++++++ .../TestService/Reference.svcmap | 31 +++ .../TestService/configuration.svcinfo | 10 + .../TestService/configuration91.svcinfo | 201 ++++++++++++++++++ oop/WpfApp1/WpfApp1/MainWindow.xaml | 13 ++ oop/WpfApp1/WpfApp1/MainWindow.xaml.cs | 32 +++ .../WpfApp1/Properties/AssemblyInfo.cs | 55 +++++ .../WpfApp1/Properties/Resources.Designer.cs | 71 +++++++ oop/WpfApp1/WpfApp1/Properties/Resources.resx | 117 ++++++++++ .../WpfApp1/Properties/Settings.Designer.cs | 30 +++ .../WpfApp1/Properties/Settings.settings | 7 + oop/WpfApp1/WpfApp1/WpfApp1.csproj | 123 +++++++++++ 35 files changed, 1493 insertions(+) create mode 100644 oop/2018-05-05-services/2018-05-05-services.sln create mode 100644 oop/2018-05-05-services/2018-05-05-services/2018-05-05-services.csproj create mode 100644 oop/2018-05-05-services/2018-05-05-services/FirstService.svc create mode 100644 oop/2018-05-05-services/2018-05-05-services/FirstService.svc.cs create mode 100644 oop/2018-05-05-services/2018-05-05-services/Global.asax create mode 100644 oop/2018-05-05-services/2018-05-05-services/Global.asax.cs create mode 100644 oop/2018-05-05-services/2018-05-05-services/IFirstService.cs create mode 100644 oop/2018-05-05-services/2018-05-05-services/Person.cs create mode 100644 oop/2018-05-05-services/2018-05-05-services/Properties/AssemblyInfo.cs create mode 100644 oop/2018-05-05-services/2018-05-05-services/Web.Debug.config create mode 100644 oop/2018-05-05-services/2018-05-05-services/Web.Release.config create mode 100644 oop/2018-05-05-services/2018-05-05-services/Web.config create mode 100644 oop/2018-05-05-services/2018-05-05-services/packages.config create mode 100644 oop/2018-05-05_service-client/2018-05-05_service-client.sln create mode 100644 oop/2018-05-05_service-client/2018-05-05_service-client/2018-05-05_service-client.csproj create mode 100644 oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/ConnectedService.json create mode 100644 oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/Reference.cs create mode 100644 oop/2018-05-05_service-client/2018-05-05_service-client/Program.cs create mode 100644 oop/WpfApp1/WpfApp1.sln create mode 100644 oop/WpfApp1/WpfApp1/App.config create mode 100644 oop/WpfApp1/WpfApp1/App.xaml create mode 100644 oop/WpfApp1/WpfApp1/App.xaml.cs create mode 100644 oop/WpfApp1/WpfApp1/Connected Services/TestService/FirstService.wsdl create mode 100644 oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.cs create mode 100644 oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.svcmap create mode 100644 oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration.svcinfo create mode 100644 oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration91.svcinfo create mode 100644 oop/WpfApp1/WpfApp1/MainWindow.xaml create mode 100644 oop/WpfApp1/WpfApp1/MainWindow.xaml.cs create mode 100644 oop/WpfApp1/WpfApp1/Properties/AssemblyInfo.cs create mode 100644 oop/WpfApp1/WpfApp1/Properties/Resources.Designer.cs create mode 100644 oop/WpfApp1/WpfApp1/Properties/Resources.resx create mode 100644 oop/WpfApp1/WpfApp1/Properties/Settings.Designer.cs create mode 100644 oop/WpfApp1/WpfApp1/Properties/Settings.settings create mode 100644 oop/WpfApp1/WpfApp1/WpfApp1.csproj diff --git a/oop/2018-05-05-services/2018-05-05-services.sln b/oop/2018-05-05-services/2018-05-05-services.sln new file mode 100644 index 0000000..8d0ec75 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2018-05-05-services", "2018-05-05-services\2018-05-05-services.csproj", "{AD54CCFD-0C92-48AD-ACF4-A4E4369E1E81}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AD54CCFD-0C92-48AD-ACF4-A4E4369E1E81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD54CCFD-0C92-48AD-ACF4-A4E4369E1E81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD54CCFD-0C92-48AD-ACF4-A4E4369E1E81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD54CCFD-0C92-48AD-ACF4-A4E4369E1E81}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {42F7986B-3D3A-4511-ABD2-F7EB5C7579D6} + EndGlobalSection +EndGlobal diff --git a/oop/2018-05-05-services/2018-05-05-services/2018-05-05-services.csproj b/oop/2018-05-05-services/2018-05-05-services/2018-05-05-services.csproj new file mode 100644 index 0000000..4d5aa44 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/2018-05-05-services.csproj @@ -0,0 +1,139 @@ + + + + + + Debug + AnyCPU + + + 2.0 + {AD54CCFD-0C92-48AD-ACF4-A4E4369E1E81} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + _2018_05_05_services + 2018-05-05-services + v4.6.1 + true + + + + + + + + + True + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + + + + + + + + + + + + + + + + + + + + Web.config + + + Web.config + + + + + + + + + + FirstService.svc + + + Global.asax + + + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 52055 + / + http://localhost:52055/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/oop/2018-05-05-services/2018-05-05-services/FirstService.svc b/oop/2018-05-05-services/2018-05-05-services/FirstService.svc new file mode 100644 index 0000000..a235119 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/FirstService.svc @@ -0,0 +1 @@ +<%@ ServiceHost Language="C#" Debug="true" Service="_2018_05_05_services.FirstService" CodeBehind="FirstService.svc.cs" %> diff --git a/oop/2018-05-05-services/2018-05-05-services/FirstService.svc.cs b/oop/2018-05-05-services/2018-05-05-services/FirstService.svc.cs new file mode 100644 index 0000000..17ba445 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/FirstService.svc.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.Text; + +namespace _2018_05_05_services +{ + // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "FirstService" in code, svc and config file together. + // NOTE: In order to launch WCF Test Client for testing this service, please select FirstService.svc or FirstService.svc.cs at the Solution Explorer and start debugging. + public class FirstService : IFirstService + { + public Person GetPerson() + { + Person person = new Person(); + person.firstName = "Max"; + person.lastName = "Muster"; + return person; + } + + public string HelloWorld() + { + return "Hello World"; + } + } +} diff --git a/oop/2018-05-05-services/2018-05-05-services/Global.asax b/oop/2018-05-05-services/2018-05-05-services/Global.asax new file mode 100644 index 0000000..4cafc59 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="_2018_05_05_services.Global" Language="C#" %> diff --git a/oop/2018-05-05-services/2018-05-05-services/Global.asax.cs b/oop/2018-05-05-services/2018-05-05-services/Global.asax.cs new file mode 100644 index 0000000..b49eaa7 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Global.asax.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.SessionState; + +namespace _2018_05_05_services +{ + public class Global : System.Web.HttpApplication + { + protected void Application_Start(object sender, EventArgs e) + { + } + } +} \ No newline at end of file diff --git a/oop/2018-05-05-services/2018-05-05-services/IFirstService.cs b/oop/2018-05-05-services/2018-05-05-services/IFirstService.cs new file mode 100644 index 0000000..ee5979d --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/IFirstService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.Text; + +namespace _2018_05_05_services +{ + // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IFirstService" in both code and config file together. + [ServiceContract] + public interface IFirstService + { + [OperationContract] + string HelloWorld(); + [DataContract] + } +} diff --git a/oop/2018-05-05-services/2018-05-05-services/Person.cs b/oop/2018-05-05-services/2018-05-05-services/Person.cs new file mode 100644 index 0000000..af6673f --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Person.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace _2018_05_05_services +{ + public class Person + { + public string firstName; + public string lastName; + } +} \ No newline at end of file diff --git a/oop/2018-05-05-services/2018-05-05-services/Properties/AssemblyInfo.cs b/oop/2018-05-05-services/2018-05-05-services/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0aee2ac --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("_2018_05_05_services")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("_2018_05_05_services")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ad54ccfd-0c92-48ad-acf4-a4e4369e1e81")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/oop/2018-05-05-services/2018-05-05-services/Web.Debug.config b/oop/2018-05-05-services/2018-05-05-services/Web.Debug.config new file mode 100644 index 0000000..fae9cfe --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/oop/2018-05-05-services/2018-05-05-services/Web.Release.config b/oop/2018-05-05-services/2018-05-05-services/Web.Release.config new file mode 100644 index 0000000..da6e960 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/oop/2018-05-05-services/2018-05-05-services/Web.config b/oop/2018-05-05-services/2018-05-05-services/Web.config new file mode 100644 index 0000000..ade67d1 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/Web.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oop/2018-05-05-services/2018-05-05-services/packages.config b/oop/2018-05-05-services/2018-05-05-services/packages.config new file mode 100644 index 0000000..3c54ec7 --- /dev/null +++ b/oop/2018-05-05-services/2018-05-05-services/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/oop/2018-05-05_service-client/2018-05-05_service-client.sln b/oop/2018-05-05_service-client/2018-05-05_service-client.sln new file mode 100644 index 0000000..ff88e83 --- /dev/null +++ b/oop/2018-05-05_service-client/2018-05-05_service-client.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2018-05-05_service-client", "2018-05-05_service-client\2018-05-05_service-client.csproj", "{840C4F68-5433-4CA4-B3D5-C33C719A4E27}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {840C4F68-5433-4CA4-B3D5-C33C719A4E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {840C4F68-5433-4CA4-B3D5-C33C719A4E27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {840C4F68-5433-4CA4-B3D5-C33C719A4E27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {840C4F68-5433-4CA4-B3D5-C33C719A4E27}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4AEDDD7D-2C25-4DF7-97FA-210A6FE0FF5B} + EndGlobalSection +EndGlobal diff --git a/oop/2018-05-05_service-client/2018-05-05_service-client/2018-05-05_service-client.csproj b/oop/2018-05-05_service-client/2018-05-05_service-client/2018-05-05_service-client.csproj new file mode 100644 index 0000000..36e674c --- /dev/null +++ b/oop/2018-05-05_service-client/2018-05-05_service-client/2018-05-05_service-client.csproj @@ -0,0 +1,19 @@ + + + + Exe + netcoreapp2.0 + + + + + + + + + + + + + + diff --git a/oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/ConnectedService.json b/oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/ConnectedService.json new file mode 100644 index 0000000..ce10aa7 --- /dev/null +++ b/oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/ConnectedService.json @@ -0,0 +1,24 @@ +{ + "ProviderId": "Microsoft.VisualStudio.ConnectedService.Wcf", + "Version": "15.0.20119.1312", + "ExtendedData": { + "Uri": "http://localhost:52055/FirstService.svc?singleWsdl", + "Namespace": "TestService", + "SelectedAccessLevelForGeneratedClass": "Public", + "GenerateMessageContract": false, + "ReuseTypesinReferencedAssemblies": true, + "ReuseTypesinAllReferencedAssemblies": true, + "CollectionTypeReference": { + "Item1": "System.Array", + "Item2": "System.Runtime.dll" + }, + "DictionaryCollectionTypeReference": { + "Item1": "System.Collections.Generic.Dictionary`2", + "Item2": "System.Collections.dll" + }, + "CheckedReferencedAssemblies": [], + "InstanceId": null, + "Name": "TestService", + "Metadata": {} + } +} \ No newline at end of file diff --git a/oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/Reference.cs b/oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/Reference.cs new file mode 100644 index 0000000..d3ef366 --- /dev/null +++ b/oop/2018-05-05_service-client/2018-05-05_service-client/Connected Services/TestService/Reference.cs @@ -0,0 +1,127 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// // +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace TestService +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="TestService.IFirstService")] + public interface IFirstService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IFirstService/HelloWorld", ReplyAction="http://tempuri.org/IFirstService/HelloWorldResponse")] + System.Threading.Tasks.Task HelloWorldAsync(); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")] + public interface IFirstServiceChannel : TestService.IFirstService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.0")] + public partial class FirstServiceClient : System.ServiceModel.ClientBase, TestService.IFirstService + { + + /// + /// Implement this partial method to configure the service endpoint. + /// + /// The endpoint to configure + /// The client credentials + static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); + + public FirstServiceClient() : + base(FirstServiceClient.GetDefaultBinding(), FirstServiceClient.GetDefaultEndpointAddress()) + { + this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IFirstService.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public FirstServiceClient(EndpointConfiguration endpointConfiguration) : + base(FirstServiceClient.GetBindingForEndpoint(endpointConfiguration), FirstServiceClient.GetEndpointAddress(endpointConfiguration)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public FirstServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : + base(FirstServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public FirstServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : + base(FirstServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public FirstServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public System.Threading.Tasks.Task HelloWorldAsync() + { + return base.Channel.HelloWorldAsync(); + } + + public virtual System.Threading.Tasks.Task OpenAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); + } + + public virtual System.Threading.Tasks.Task CloseAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndClose)); + } + + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IFirstService)) + { + System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); + result.MaxBufferSize = int.MaxValue; + result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; + result.MaxReceivedMessageSize = int.MaxValue; + result.AllowCookies = true; + return result; + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IFirstService)) + { + return new System.ServiceModel.EndpointAddress("http://localhost:52055/FirstService.svc"); + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.Channels.Binding GetDefaultBinding() + { + return FirstServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IFirstService); + } + + private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() + { + return FirstServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IFirstService); + } + + public enum EndpointConfiguration + { + + BasicHttpBinding_IFirstService, + } + } +} diff --git a/oop/2018-05-05_service-client/2018-05-05_service-client/Program.cs b/oop/2018-05-05_service-client/2018-05-05_service-client/Program.cs new file mode 100644 index 0000000..8b0cf33 --- /dev/null +++ b/oop/2018-05-05_service-client/2018-05-05_service-client/Program.cs @@ -0,0 +1,14 @@ +using System; +using TestService; + +namespace _2018_05_05_service_client +{ + class Program + { + static void Main(string[] args) + { + FirstServiceClient something = new FirstServiceClient(); + string newstring = something.HelloWorld(); + } + } +} diff --git a/oop/WpfApp1/WpfApp1.sln b/oop/WpfApp1/WpfApp1.sln new file mode 100644 index 0000000..5532d17 --- /dev/null +++ b/oop/WpfApp1/WpfApp1.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{A272A06D-18FF-442A-9C72-EC7E98505ABC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A272A06D-18FF-442A-9C72-EC7E98505ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A272A06D-18FF-442A-9C72-EC7E98505ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A272A06D-18FF-442A-9C72-EC7E98505ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A272A06D-18FF-442A-9C72-EC7E98505ABC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7D8A38D5-26D0-43D5-8B11-C80CF6EDBDEB} + EndGlobalSection +EndGlobal diff --git a/oop/WpfApp1/WpfApp1/App.config b/oop/WpfApp1/WpfApp1/App.config new file mode 100644 index 0000000..636e789 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/App.xaml b/oop/WpfApp1/WpfApp1/App.xaml new file mode 100644 index 0000000..2e70522 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/oop/WpfApp1/WpfApp1/App.xaml.cs b/oop/WpfApp1/WpfApp1/App.xaml.cs new file mode 100644 index 0000000..909eaa5 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfApp1 +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/oop/WpfApp1/WpfApp1/Connected Services/TestService/FirstService.wsdl b/oop/WpfApp1/WpfApp1/Connected Services/TestService/FirstService.wsdl new file mode 100644 index 0000000..7a21639 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Connected Services/TestService/FirstService.wsdl @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.cs b/oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.cs new file mode 100644 index 0000000..6145e33 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WpfApp1.TestService { + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="TestService.IFirstService")] + public interface IFirstService { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IFirstService/HelloWorld", ReplyAction="http://tempuri.org/IFirstService/HelloWorldResponse")] + string HelloWorld(); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IFirstService/HelloWorld", ReplyAction="http://tempuri.org/IFirstService/HelloWorldResponse")] + System.Threading.Tasks.Task HelloWorldAsync(); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IFirstServiceChannel : WpfApp1.TestService.IFirstService, System.ServiceModel.IClientChannel { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class FirstServiceClient : System.ServiceModel.ClientBase, WpfApp1.TestService.IFirstService { + + public FirstServiceClient() { + } + + public FirstServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) { + } + + public FirstServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public FirstServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public FirstServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) { + } + + public string HelloWorld() { + return base.Channel.HelloWorld(); + } + + public System.Threading.Tasks.Task HelloWorldAsync() { + return base.Channel.HelloWorldAsync(); + } + } +} diff --git a/oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.svcmap b/oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.svcmap new file mode 100644 index 0000000..be6d82f --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Connected Services/TestService/Reference.svcmap @@ -0,0 +1,31 @@ + + + + false + true + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration.svcinfo b/oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration.svcinfo new file mode 100644 index 0000000..4a5185a --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration.svcinfo @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration91.svcinfo b/oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration91.svcinfo new file mode 100644 index 0000000..02cc4f6 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Connected Services/TestService/configuration91.svcinfo @@ -0,0 +1,201 @@ + + + + + + + BasicHttpBinding_IFirstService + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + + + http://localhost:52055/FirstService.svc + + + + + + basicHttpBinding + + + BasicHttpBinding_IFirstService + + + TestService.IFirstService + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + BasicHttpBinding_IFirstService + + + + + + + + + + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/MainWindow.xaml b/oop/WpfApp1/WpfApp1/MainWindow.xaml new file mode 100644 index 0000000..960d6d9 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/MainWindow.xaml @@ -0,0 +1,13 @@ + + + + diff --git a/oop/WpfApp1/WpfApp1/MainWindow.xaml.cs b/oop/WpfApp1/WpfApp1/MainWindow.xaml.cs new file mode 100644 index 0000000..4e69db0 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/MainWindow.xaml.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using WpfApp1.TestService; + +namespace WpfApp1 +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + TestService.FirstServiceClient service = new TestService.FirstServiceClient(); + string newstring = service.HelloWorld(); + ServiceLabel.Content = newstring; + } + } +} diff --git a/oop/WpfApp1/WpfApp1/Properties/AssemblyInfo.cs b/oop/WpfApp1/WpfApp1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..74bf457 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WpfApp1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WpfApp1")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/oop/WpfApp1/WpfApp1/Properties/Resources.Designer.cs b/oop/WpfApp1/WpfApp1/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c8c627c --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WpfApp1.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfApp1.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/oop/WpfApp1/WpfApp1/Properties/Resources.resx b/oop/WpfApp1/WpfApp1/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/Properties/Settings.Designer.cs b/oop/WpfApp1/WpfApp1/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6512fd0 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WpfApp1.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/oop/WpfApp1/WpfApp1/Properties/Settings.settings b/oop/WpfApp1/WpfApp1/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/oop/WpfApp1/WpfApp1/WpfApp1.csproj b/oop/WpfApp1/WpfApp1/WpfApp1.csproj new file mode 100644 index 0000000..9ccaee1 --- /dev/null +++ b/oop/WpfApp1/WpfApp1/WpfApp1.csproj @@ -0,0 +1,123 @@ + + + + + Debug + AnyCPU + {A272A06D-18FF-442A-9C72-EC7E98505ABC} + WinExe + WpfApp1 + WpfApp1 + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + True + True + Reference.svcmap + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + + + + WCF Proxy Generator + Reference.cs + + + + \ No newline at end of file