diff --git a/src/SoapCore.Tests/MessageContract/Models/IArrayOfArrayOfByteService.cs b/src/SoapCore.Tests/MessageContract/Models/IArrayOfArrayOfByteService.cs new file mode 100644 index 00000000..f5b7b3b1 --- /dev/null +++ b/src/SoapCore.Tests/MessageContract/Models/IArrayOfArrayOfByteService.cs @@ -0,0 +1,30 @@ +using System.ServiceModel; +using System.Text; + +namespace SoapCore.Tests.MessageContract.Models +{ + [ServiceContract(Namespace = "http://tempuri.org")] + public interface IArrayOfArrayOfByteService + { + [OperationContract] + string ArrayOfArrayOfByteMethod(byte[][] arrayOfArrayOfByteParam); + } + + public class ArrayOfArrayOfByteService : IArrayOfArrayOfByteService + { + public string ArrayOfArrayOfByteMethod(byte[][] arrayOfArrayOfByteParam) + { + var ret = new StringBuilder(); + ret.Append("["); + foreach (var array in arrayOfArrayOfByteParam) + { + ret.Append("["); + ret.Append(string.Join(",", array)); + ret.Append("]"); + } + + ret.Append("]"); + return ret.ToString(); + } + } +} diff --git a/src/SoapCore.Tests/MessageContract/RawRequestSoap11Tests.cs b/src/SoapCore.Tests/MessageContract/RawRequestSoap11Tests.cs index 15d48f32..ca8f6d59 100644 --- a/src/SoapCore.Tests/MessageContract/RawRequestSoap11Tests.cs +++ b/src/SoapCore.Tests/MessageContract/RawRequestSoap11Tests.cs @@ -134,6 +134,29 @@ public async Task Soap11MessageContractArrayOfIntParamWrapped() } } + [TestMethod] + public async Task SoapArrayOfArrayOfByte() + { + const string body = @" + + + + AQI=AgM=BAU=BgU= + + +"; + + using (var host = CreateTestHost(typeof(ArrayOfArrayOfByteService))) + using (var client = host.CreateClient()) + using (var content = new StringContent(body, Encoding.UTF8, "text/xml")) + using (var res = await host.CreateRequest("/Service.asmx").AddHeader("SOAPAction", @"""ArrayOfArrayOfByteMethod""").And(msg => msg.Content = content).PostAsync()) + { + res.EnsureSuccessStatusCode(); + var resultMessage = await res.Content.ReadAsStringAsync(); + Assert.IsTrue(resultMessage.Contains("[[1,2][2,3][4,5][6,5]]")); + } + } + [TestMethod] public async Task Soap11MessageContractComplexNotWrapped() { diff --git a/src/SoapCore/SerializerHelper.cs b/src/SoapCore/SerializerHelper.cs index 69c30a5f..f30ed73a 100644 --- a/src/SoapCore/SerializerHelper.cs +++ b/src/SoapCore/SerializerHelper.cs @@ -43,7 +43,7 @@ public object DeserializeInputParameter( switch (_serializer) { case SoapSerializer.XmlSerializer: - if (!parameterType.IsArray) + if (!parameterType.IsArray || parameterType.GetElementType()?.IsArray == true) { // case [XmlElement("parameter")] int parameter // case [XmlArray("parameter")] int[] parameter