From c4402e61a0af73bb2ee3e793591d3c8de101d9ca Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Tue, 25 Jun 2019 22:39:29 +0200 Subject: [PATCH 1/9] Add project information and contributors details --- src/Wps/Wps.Client/Wps.Client.csproj | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Wps/Wps.Client/Wps.Client.csproj b/src/Wps/Wps.Client/Wps.Client.csproj index 9f5c4f4..3b47e6d 100644 --- a/src/Wps/Wps.Client/Wps.Client.csproj +++ b/src/Wps/Wps.Client/Wps.Client.csproj @@ -1,7 +1,31 @@ - + netstandard2.0 + Mihai Stan, Benjamin Pross + 52°North + WPS Library + This is a library that allows developers to speed up their development when working with WPS providers. + https://github.com/52North/wps.net + wps library client + https://github.com/52North/wps.net + + true + false + LICENSE + Wps.Net + + + + + + + + True + + + + From cc4d1a80a49ad77b2b4557c0899ee58095a31ae6 Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Mon, 22 Jul 2019 13:33:16 +0200 Subject: [PATCH 2/9] Output result as raw XML if outpu data type is string --- src/Wps/Wps.Client/Models/ResultOutput.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Wps/Wps.Client/Models/ResultOutput.cs b/src/Wps/Wps.Client/Models/ResultOutput.cs index 959d0e4..528f735 100644 --- a/src/Wps/Wps.Client/Models/ResultOutput.cs +++ b/src/Wps/Wps.Client/Models/ResultOutput.cs @@ -1,4 +1,5 @@ -using System.Xml; +using System; +using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using Wps.Client.Services; @@ -47,7 +48,14 @@ public void ReadXml(XmlReader reader) if (subtreeReader.LocalName.Equals("Data")) { var content = subtreeReader.ReadInnerXml(); - Data = serializer.Deserialize(content); + if (typeof(TData) == typeof(string)) + { + Data = (TData) Convert.ChangeType(content, typeof(string)); + } + else + { + Data = serializer.Deserialize(content); + } } if (subtreeReader.LocalName.Equals("Output")) From 51bbb6e1acd70f3d1dbc57eaa0b6b63fa61a1bd2 Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Mon, 22 Jul 2019 14:19:47 +0200 Subject: [PATCH 3/9] Update package version to 1.0.1 --- src/Wps/Wps.Client/Wps.Client.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Wps/Wps.Client/Wps.Client.csproj b/src/Wps/Wps.Client/Wps.Client.csproj index 3b47e6d..f54c793 100644 --- a/src/Wps/Wps.Client/Wps.Client.csproj +++ b/src/Wps/Wps.Client/Wps.Client.csproj @@ -14,6 +14,7 @@ false LICENSE Wps.Net + 1.0.1 From 03287ccda415162bac8b532d8a7e87b092c443c6 Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Mon, 19 Aug 2019 22:49:57 +0200 Subject: [PATCH 4/9] Add data formats for the input model --- src/Wps/Wps.Client.Tests/ModelSerializationTests.cs | 7 +++++-- src/Wps/Wps.Client/Models/Execution/DataInput.cs | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs b/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs index 8708738..5f33e47 100644 --- a/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs +++ b/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs @@ -137,7 +137,7 @@ public void SerializeValueRange_ValidRangeGiven_ShouldPass() [Fact] public void SerializeDataInput_ValidInputGiven_ShouldPass() { - const string expectedXml = @"105"; + const string expectedXml = @"105"; // Remove white spaces and new line characters for XML comparison. var trimmedExpectedXml = Regex.Replace(expectedXml, @"\s+", string.Empty); @@ -153,7 +153,10 @@ public void SerializeDataInput_ValidInputGiven_ShouldPass() Data = new LiteralDataValue { Value = 105.ToString(CultureInfo.InvariantCulture) - } + }, + MimeType = "test mime type", + Schema = "test schema", + Encoding = "test encoding" }; var resultXml = _serializer.Serialize(dataInput); diff --git a/src/Wps/Wps.Client/Models/Execution/DataInput.cs b/src/Wps/Wps.Client/Models/Execution/DataInput.cs index af18978..c2f6ff3 100644 --- a/src/Wps/Wps.Client/Models/Execution/DataInput.cs +++ b/src/Wps/Wps.Client/Models/Execution/DataInput.cs @@ -10,6 +10,10 @@ namespace Wps.Client.Models.Execution public class DataInput : IXmlSerializable { + public string MimeType { get; set; } + public string Encoding { get; set; } + public string Schema { get; set; } + public string Identifier { get; set; } public object Data { get; set; } public ResourceReference Reference { get; set; } @@ -30,6 +34,9 @@ public void WriteXml(XmlWriter writer) var xmlSerializer = new XmlSerializationService(); writer.WriteAttributeString("id", Identifier); + if (!string.IsNullOrEmpty(MimeType)) writer.WriteAttributeString("mimeType", MimeType); + if (!string.IsNullOrEmpty(Encoding)) writer.WriteAttributeString("encoding", Encoding); + if (!string.IsNullOrEmpty(Schema)) writer.WriteAttributeString("schema", Schema); if (Data != null) { From 53eb0a52f9b0db86309235eafae1a626e5c9540a Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Mon, 19 Aug 2019 22:50:04 +0200 Subject: [PATCH 5/9] Remove unused reference in test project --- src/Wps/Wps.Client.Tests/WpsClientTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Wps/Wps.Client.Tests/WpsClientTests.cs b/src/Wps/Wps.Client.Tests/WpsClientTests.cs index 4175760..d67b505 100644 --- a/src/Wps/Wps.Client.Tests/WpsClientTests.cs +++ b/src/Wps/Wps.Client.Tests/WpsClientTests.cs @@ -14,7 +14,6 @@ using Wps.Client.Models.Requests; using Wps.Client.Services; using Xunit; -using Xunit.Sdk; namespace Wps.Client.Tests { From 9798769a72aac7a7d9ccb43d1e58bdeb6a1680ec Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Wed, 21 Aug 2019 13:11:21 +0200 Subject: [PATCH 6/9] Update package version to 1.0.2 --- src/Wps/Wps.Client/Wps.Client.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wps/Wps.Client/Wps.Client.csproj b/src/Wps/Wps.Client/Wps.Client.csproj index f54c793..26d4439 100644 --- a/src/Wps/Wps.Client/Wps.Client.csproj +++ b/src/Wps/Wps.Client/Wps.Client.csproj @@ -14,7 +14,7 @@ false LICENSE Wps.Net - 1.0.1 + 1.0.2 From abc9b47dbeca1f1d4767b71cf5bb75fb77182c92 Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Wed, 21 Aug 2019 13:16:22 +0200 Subject: [PATCH 7/9] Write the data format information on the tag of the datainput --- src/Wps/Wps.Client.Tests/ModelSerializationTests.cs | 2 +- src/Wps/Wps.Client/Models/Execution/DataInput.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs b/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs index 5f33e47..26d99ce 100644 --- a/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs +++ b/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs @@ -137,7 +137,7 @@ public void SerializeValueRange_ValidRangeGiven_ShouldPass() [Fact] public void SerializeDataInput_ValidInputGiven_ShouldPass() { - const string expectedXml = @"105"; + const string expectedXml = @"105"; // Remove white spaces and new line characters for XML comparison. var trimmedExpectedXml = Regex.Replace(expectedXml, @"\s+", string.Empty); diff --git a/src/Wps/Wps.Client/Models/Execution/DataInput.cs b/src/Wps/Wps.Client/Models/Execution/DataInput.cs index c2f6ff3..94bf614 100644 --- a/src/Wps/Wps.Client/Models/Execution/DataInput.cs +++ b/src/Wps/Wps.Client/Models/Execution/DataInput.cs @@ -34,13 +34,13 @@ public void WriteXml(XmlWriter writer) var xmlSerializer = new XmlSerializationService(); writer.WriteAttributeString("id", Identifier); - if (!string.IsNullOrEmpty(MimeType)) writer.WriteAttributeString("mimeType", MimeType); - if (!string.IsNullOrEmpty(Encoding)) writer.WriteAttributeString("encoding", Encoding); - if (!string.IsNullOrEmpty(Schema)) writer.WriteAttributeString("schema", Schema); if (Data != null) { writer.WriteStartElement("wps", "Data", ModelNamespaces.Wps); + if (!string.IsNullOrEmpty(MimeType)) writer.WriteAttributeString("mimeType", MimeType); + if (!string.IsNullOrEmpty(Encoding)) writer.WriteAttributeString("encoding", Encoding); + if (!string.IsNullOrEmpty(Schema)) writer.WriteAttributeString("schema", Schema); writer.WriteRaw(xmlSerializer.Serialize(Data, true)); writer.WriteEndElement(); } From 14118682c0d5d6096acd5a91993e3d9643c759fd Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Wed, 21 Aug 2019 13:49:02 +0200 Subject: [PATCH 8/9] Copy the data input as is when the data type is string --- src/Wps/Wps.Client.Tests/ModelSerializationTests.cs | 11 ++++++----- src/Wps/Wps.Client/Models/Execution/DataInput.cs | 12 +++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs b/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs index 26d99ce..9f50d87 100644 --- a/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs +++ b/src/Wps/Wps.Client.Tests/ModelSerializationTests.cs @@ -137,7 +137,7 @@ public void SerializeValueRange_ValidRangeGiven_ShouldPass() [Fact] public void SerializeDataInput_ValidInputGiven_ShouldPass() { - const string expectedXml = @"105"; + const string expectedXml = @"test string"; // Remove white spaces and new line characters for XML comparison. var trimmedExpectedXml = Regex.Replace(expectedXml, @"\s+", string.Empty); @@ -150,10 +150,11 @@ public void SerializeDataInput_ValidInputGiven_ShouldPass() Href = "test", Schema = "test-schema" }, - Data = new LiteralDataValue - { - Value = 105.ToString(CultureInfo.InvariantCulture) - }, + //Data = new LiteralDataValue + //{ + // Value = 105.ToString(CultureInfo.InvariantCulture) + //}, + Data = "test string", MimeType = "test mime type", Schema = "test schema", Encoding = "test encoding" diff --git a/src/Wps/Wps.Client/Models/Execution/DataInput.cs b/src/Wps/Wps.Client/Models/Execution/DataInput.cs index 94bf614..0cf0107 100644 --- a/src/Wps/Wps.Client/Models/Execution/DataInput.cs +++ b/src/Wps/Wps.Client/Models/Execution/DataInput.cs @@ -6,6 +6,9 @@ namespace Wps.Client.Models.Execution { + /// + /// The data input model used for the execution requests. If the data is of type it will be copied inside the data tags as is with no further serialization. + /// [XmlRoot("Input", Namespace = ModelNamespaces.Wps)] public class DataInput : IXmlSerializable { @@ -41,7 +44,14 @@ public void WriteXml(XmlWriter writer) if (!string.IsNullOrEmpty(MimeType)) writer.WriteAttributeString("mimeType", MimeType); if (!string.IsNullOrEmpty(Encoding)) writer.WriteAttributeString("encoding", Encoding); if (!string.IsNullOrEmpty(Schema)) writer.WriteAttributeString("schema", Schema); - writer.WriteRaw(xmlSerializer.Serialize(Data, true)); + if (Data is string s) + { + writer.WriteRaw(s); + } + else + { + writer.WriteRaw(xmlSerializer.Serialize(Data, true)); + } writer.WriteEndElement(); } From 5e7789d9866a0abbf5f2551a3562c866a7f520dc Mon Sep 17 00:00:00 2001 From: Mihai Stan Date: Wed, 21 Aug 2019 16:33:18 +0200 Subject: [PATCH 9/9] Update package version to 1.0.3 --- src/Wps/Wps.Client/Wps.Client.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wps/Wps.Client/Wps.Client.csproj b/src/Wps/Wps.Client/Wps.Client.csproj index 26d4439..923b220 100644 --- a/src/Wps/Wps.Client/Wps.Client.csproj +++ b/src/Wps/Wps.Client/Wps.Client.csproj @@ -14,7 +14,7 @@ false LICENSE Wps.Net - 1.0.2 + 1.0.3