diff --git a/Soap/src/Main.java b/Soap/src/Main.java deleted file mode 100644 index 930198c..0000000 --- a/Soap/src/Main.java +++ /dev/null @@ -1,15 +0,0 @@ -//TIP To Run code, press or -// click the icon in the gutter. -public class Main { - public static void main(String[] args) { - //TIP Press with your caret at the highlighted text - // to see how IntelliJ IDEA suggests fixing it. - System.out.printf("Hello and welcome!"); - - for (int i = 1; i <= 5; i++) { - //TIP Press to start debugging your code. We have set one breakpoint - // for you, but you can always add more by pressing . - System.out.println("i = " + i); - } - } -} \ No newline at end of file diff --git a/SoapClient/.idea/.idea.SoapClient/.idea/.gitignore b/SoapClient/.idea/.idea.SoapClient/.idea/.gitignore new file mode 100644 index 0000000..c734ed8 --- /dev/null +++ b/SoapClient/.idea/.idea.SoapClient/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +/.idea.SoapClient.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/SoapClient/.idea/.idea.SoapClient/.idea/encodings.xml b/SoapClient/.idea/.idea.SoapClient/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/SoapClient/.idea/.idea.SoapClient/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SoapClient/.idea/.idea.SoapClient/.idea/indexLayout.xml b/SoapClient/.idea/.idea.SoapClient/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/SoapClient/.idea/.idea.SoapClient/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/SoapClient/.idea/.idea.SoapClient/.idea/vcs.xml b/SoapClient/.idea/.idea.SoapClient/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/SoapClient/.idea/.idea.SoapClient/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SoapClient/Connected Services/UserSOAPServiceImplService/ConnectedService.json b/SoapClient/Connected Services/UserSOAPServiceImplService/ConnectedService.json new file mode 100644 index 0000000..127fbd9 --- /dev/null +++ b/SoapClient/Connected Services/UserSOAPServiceImplService/ConnectedService.json @@ -0,0 +1,15 @@ +{ + "providerId": "Microsoft.Tools.ServiceModel.Svcutil", + "version": "2.1.0", + "ExtendedData": { + "inputs": [ + "http://localhost:7779/ws/user?wsdl" + ], + "namespaceMappings": [ + "*, SoapClient.UserSOAPServiceImplService" + ], + "outputFile": "UserSOAPServiceImplService.cs", + "targetFramework": "net8.0", + "typeReuseMode": "All" + } +} \ No newline at end of file diff --git a/SoapClient/Connected Services/UserSOAPServiceImplService/UserSOAPServiceImplService.cs b/SoapClient/Connected Services/UserSOAPServiceImplService/UserSOAPServiceImplService.cs new file mode 100644 index 0000000..2353c82 --- /dev/null +++ b/SoapClient/Connected Services/UserSOAPServiceImplService/UserSOAPServiceImplService.cs @@ -0,0 +1,258 @@ +//------------------------------------------------------------------------------ +// +// 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 SoapClient.UserSOAPServiceImplService +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + [System.ServiceModel.ServiceContractAttribute(Namespace="http://soapsoapsoap.com/", ConfigurationName="SoapClient.UserSOAPServiceImplService.UserSOAPService")] + public interface UserSOAPService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://soapsoapsoap.com/UserSOAPService/addScoreRequest", ReplyAction="http://soapsoapsoap.com/UserSOAPService/addScoreResponse")] + [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true)] + [return: System.ServiceModel.MessageParameterAttribute(Name="return")] + System.Threading.Tasks.Task addScoreAsync(int arg0, string arg1, double arg2); + + [System.ServiceModel.OperationContractAttribute(Action="http://soapsoapsoap.com/UserSOAPService/getUsersListRequest", ReplyAction="http://soapsoapsoap.com/UserSOAPService/getUsersListResponse")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task getUsersListAsync(SoapClient.UserSOAPServiceImplService.getUsersListRequest request); + + [System.ServiceModel.OperationContractAttribute(Action="http://soapsoapsoap.com/UserSOAPService/getUserByIdRequest", ReplyAction="http://soapsoapsoap.com/UserSOAPService/getUserByIdResponse")] + [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true)] + [return: System.ServiceModel.MessageParameterAttribute(Name="return")] + System.Threading.Tasks.Task getUserByIdAsync(int arg0); + + [System.ServiceModel.OperationContractAttribute(Action="http://soapsoapsoap.com/UserSOAPService/calculateAverageScoreRequest", ReplyAction="http://soapsoapsoap.com/UserSOAPService/calculateAverageScoreResponse")] + [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true)] + [return: System.ServiceModel.MessageParameterAttribute(Name="return")] + System.Threading.Tasks.Task calculateAverageScoreAsync(int arg0); + + [System.ServiceModel.OperationContractAttribute(Action="http://soapsoapsoap.com/UserSOAPService/findActivitiesByScoreRequest", ReplyAction="http://soapsoapsoap.com/UserSOAPService/findActivitiesByScoreResponse")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task findActivitiesByScoreAsync(SoapClient.UserSOAPServiceImplService.findActivitiesByScoreRequest request); + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.ServiceModel.MessageContractAttribute(WrapperName="getUsersList", WrapperNamespace="http://soapsoapsoap.com/", IsWrapped=true)] + public partial class getUsersListRequest + { + + public getUsersListRequest() + { + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.ServiceModel.MessageContractAttribute(WrapperName="getUsersListResponse", WrapperNamespace="http://soapsoapsoap.com/", IsWrapped=true)] + public partial class getUsersListResponse + { + + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)] + [System.Xml.Serialization.XmlArrayAttribute()] + [System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string[] @return; + + public getUsersListResponse() + { + } + + public getUsersListResponse(string[] @return) + { + this.@return = @return; + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.ServiceModel.MessageContractAttribute(WrapperName="findActivitiesByScore", WrapperNamespace="http://soapsoapsoap.com/", IsWrapped=true)] + public partial class findActivitiesByScoreRequest + { + + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)] + public string arg0; + + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)] + public double arg1; + + public findActivitiesByScoreRequest() + { + } + + public findActivitiesByScoreRequest(string arg0, double arg1) + { + this.arg0 = arg0; + this.arg1 = arg1; + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + [System.ServiceModel.MessageContractAttribute(WrapperName="findActivitiesByScoreResponse", WrapperNamespace="http://soapsoapsoap.com/", IsWrapped=true)] + public partial class findActivitiesByScoreResponse + { + + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)] + [System.Xml.Serialization.XmlArrayAttribute()] + [System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string[] @return; + + public findActivitiesByScoreResponse() + { + } + + public findActivitiesByScoreResponse(string[] @return) + { + this.@return = @return; + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + public interface UserSOAPServiceChannel : SoapClient.UserSOAPServiceImplService.UserSOAPService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + public partial class UserSOAPServiceClient : System.ServiceModel.ClientBase, SoapClient.UserSOAPServiceImplService.UserSOAPService + { + + /// + /// 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 UserSOAPServiceClient() : + base(UserSOAPServiceClient.GetDefaultBinding(), UserSOAPServiceClient.GetDefaultEndpointAddress()) + { + this.Endpoint.Name = EndpointConfiguration.UserSOAPServiceImplPort.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UserSOAPServiceClient(EndpointConfiguration endpointConfiguration) : + base(UserSOAPServiceClient.GetBindingForEndpoint(endpointConfiguration), UserSOAPServiceClient.GetEndpointAddress(endpointConfiguration)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UserSOAPServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : + base(UserSOAPServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UserSOAPServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : + base(UserSOAPServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public UserSOAPServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public System.Threading.Tasks.Task addScoreAsync(int arg0, string arg1, double arg2) + { + return base.Channel.addScoreAsync(arg0, arg1, arg2); + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + System.Threading.Tasks.Task SoapClient.UserSOAPServiceImplService.UserSOAPService.getUsersListAsync(SoapClient.UserSOAPServiceImplService.getUsersListRequest request) + { + return base.Channel.getUsersListAsync(request); + } + + public System.Threading.Tasks.Task getUsersListAsync() + { + SoapClient.UserSOAPServiceImplService.getUsersListRequest inValue = new SoapClient.UserSOAPServiceImplService.getUsersListRequest(); + return ((SoapClient.UserSOAPServiceImplService.UserSOAPService)(this)).getUsersListAsync(inValue); + } + + public System.Threading.Tasks.Task getUserByIdAsync(int arg0) + { + return base.Channel.getUserByIdAsync(arg0); + } + + public System.Threading.Tasks.Task calculateAverageScoreAsync(int arg0) + { + return base.Channel.calculateAverageScoreAsync(arg0); + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + System.Threading.Tasks.Task SoapClient.UserSOAPServiceImplService.UserSOAPService.findActivitiesByScoreAsync(SoapClient.UserSOAPServiceImplService.findActivitiesByScoreRequest request) + { + return base.Channel.findActivitiesByScoreAsync(request); + } + + public System.Threading.Tasks.Task findActivitiesByScoreAsync(string arg0, double arg1) + { + SoapClient.UserSOAPServiceImplService.findActivitiesByScoreRequest inValue = new SoapClient.UserSOAPServiceImplService.findActivitiesByScoreRequest(); + inValue.arg0 = arg0; + inValue.arg1 = arg1; + return ((SoapClient.UserSOAPServiceImplService.UserSOAPService)(this)).findActivitiesByScoreAsync(inValue); + } + + 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)); + } + + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.UserSOAPServiceImplPort)) + { + 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.UserSOAPServiceImplPort)) + { + return new System.ServiceModel.EndpointAddress("http://localhost:7779/ws/user"); + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.Channels.Binding GetDefaultBinding() + { + return UserSOAPServiceClient.GetBindingForEndpoint(EndpointConfiguration.UserSOAPServiceImplPort); + } + + private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() + { + return UserSOAPServiceClient.GetEndpointAddress(EndpointConfiguration.UserSOAPServiceImplPort); + } + + public enum EndpointConfiguration + { + + UserSOAPServiceImplPort, + } + } +} diff --git a/SoapClient/Program.cs b/SoapClient/Program.cs new file mode 100644 index 0000000..6606473 --- /dev/null +++ b/SoapClient/Program.cs @@ -0,0 +1,53 @@ +using SoapClient.UserSOAPServiceImplService; + +var client = new UserSOAPServiceClient(UserSOAPServiceClient.EndpointConfiguration.UserSOAPServiceImplPort); + +try +{ + const int userId = 1; + const string activity = ">"; + const double score = 50.5; + + var addScoreResult = await client.addScoreAsync(userId, activity, score); + Console.WriteLine($"addScoreAsync result: {addScoreResult}"); + + var usersListResponse = await client.getUsersListAsync(); + Console.WriteLine("Users List:"); + if (usersListResponse.@return != null) + { + foreach (var user in usersListResponse.@return) + { + Console.WriteLine($"- {user}"); + } + } + else + { + Console.WriteLine("No users found."); + } + + var userById = await client.getUserByIdAsync(userId); + Console.WriteLine($"User with ID {userId}: {userById}"); + + var averageScore = await client.calculateAverageScoreAsync(userId); + Console.WriteLine($"Average score for user {userId}: {averageScore}"); + + var activitiesResponse = await client.findActivitiesByScoreAsync(activity, score); + Console.WriteLine($"Activities matching '{activity}' with score {score}:"); + if (activitiesResponse.@return != null) + { + foreach (var activityResult in activitiesResponse.@return) + { + Console.WriteLine($"- {activityResult}"); + } + } + else + { + Console.WriteLine("No matching activities found."); + } + + await client.CloseAsync(); +} +catch (Exception ex) +{ + Console.WriteLine($"An error occurred: {ex.Message}"); +} \ No newline at end of file diff --git a/SoapClient/SoapClient.csproj b/SoapClient/SoapClient.csproj new file mode 100644 index 0000000..f1603ba --- /dev/null +++ b/SoapClient/SoapClient.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + \ No newline at end of file diff --git a/SoapClient/SoapClient.sln b/SoapClient/SoapClient.sln new file mode 100644 index 0000000..ee182f9 --- /dev/null +++ b/SoapClient/SoapClient.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoapClient", "SoapClient.csproj", "{2475F92F-7933-4068-BE48-AF3AE6B8ACAA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2475F92F-7933-4068-BE48-AF3AE6B8ACAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2475F92F-7933-4068-BE48-AF3AE6B8ACAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2475F92F-7933-4068-BE48-AF3AE6B8ACAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2475F92F-7933-4068-BE48-AF3AE6B8ACAA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/SoapClient/global.json b/SoapClient/global.json new file mode 100644 index 0000000..2ddda36 --- /dev/null +++ b/SoapClient/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.0", + "rollForward": "latestMinor", + "allowPrerelease": false + } +} \ No newline at end of file