Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
else
{
#>
if (context.TestExpression("<#=member.MarshallName#>/<#=listMarshallName#>", targetDepth))
if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>/<#=listMarshallName#>", targetDepth))
{
var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>;
response.<#=member.PropertyName#>.Add(unmarshaller.Unmarshall(context));
Expand All @@ -161,7 +161,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
if(member.IsFlattened)
{
#>
if (context.TestExpression("<#=member.MarshallName#>", targetDepth))
if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>", targetDepth))
{
var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>;
response.<#=member.PropertyName#>.Add(unmarshaller.Unmarshall(context));
Expand All @@ -172,7 +172,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
else
{
#>
if (context.TestExpression("<#=member.MarshallName#>", targetDepth))
if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>", targetDepth))
{
var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>;
response.<#=member.PropertyName#> = unmarshaller.Unmarshall(context);
Expand All @@ -184,7 +184,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
else
{
#>
if (context.TestExpression("<#=member.MarshallName#>", targetDepth))
if (context.TestExpression("<#=DetermineXmlMarshallName(member)#>", targetDepth))
{
var unmarshaller = <#= member.DetermineTypeUnmarshallerInstantiate() #>;
response.<#=member.PropertyName#> = unmarshaller.Unmarshall(context);
Expand All @@ -197,7 +197,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
if (shouldMarshallPayload)
{
#>
if (context.TestExpression("<#=payload.MarshallName#>", targetDepth))
if (context.TestExpression("<#=DetermineXmlMarshallName(payload)#>", targetDepth))
{
var unmarshaller = <#= payload.DetermineTypeUnmarshallerInstantiate() #>;
response.<#=payload.PropertyName#> = unmarshaller.Unmarshall(context);
Expand Down Expand Up @@ -256,4 +256,24 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
this.AddResponseSingletonMethod();
#>
}
}
}
<#+
/* The rules for determining the marshallName for xml services is different than json services
1. Use the member locationName if the value doesn't match the member's name
2. Use the value of the locationName on the member's target if present
3. Use the name of the member's target
*/
protected string DetermineXmlMarshallName(Member member)
{
var locationName = member.data[ServiceModel.LocationNameKey];
if (locationName == null)
return member.MarshallName;
if (!string.Equals(locationName.ToString(), member.ModeledName, StringComparison.Ordinal))
{
return locationName.ToString();
}
var memberTarget = member.Shape.data[ServiceModel.LocationNameKey];

return memberTarget != null ? memberTarget.ToString() : member.Shape.Name;
}
#>
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public IRequest Marshall(FlattenedXmlMapRequest publicRequest)
xmlWriter.WriteElementString("key", kvp.Key);
xmlWriter.WriteElementString("value", kvp.Value);
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}
}

xmlWriter.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public IRequest Marshall(FlattenedXmlMapWithXmlNameRequest publicRequest)
{
foreach (var kvp in publicRequest.MyMap)
{
xmlWriter.WriteStartElement("entry");
xmlWriter.WriteStartElement("KVP");
xmlWriter.WriteElementString("K", kvp.Key);
xmlWriter.WriteElementString("V", kvp.Value);
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}
}

xmlWriter.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("nested", targetDepth))
if (context.TestExpression("NestedPayload", targetDepth))
{
var unmarshaller = NestedPayloadUnmarshaller.Instance;
response.Nested = unmarshaller.Unmarshall(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("nested", targetDepth))
if (context.TestExpression("UnionPayload", targetDepth))
{
var unmarshaller = UnionPayloadUnmarshaller.Instance;
response.Nested = unmarshaller.Unmarshall(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("nested", targetDepth))
if (context.TestExpression("Hello", targetDepth))
{
var unmarshaller = PayloadWithXmlNameUnmarshaller.Instance;
response.Nested = unmarshaller.Unmarshall(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("nested", targetDepth))
if (context.TestExpression("PayloadWithXmlNamespaceAndPrefix", targetDepth))
{
var unmarshaller = PayloadWithXmlNamespaceAndPrefixUnmarshaller.Instance;
response.Nested = unmarshaller.Unmarshall(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context, HttpPayload
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("nested", targetDepth))
if (context.TestExpression("PayloadWithXmlNamespace", targetDepth))
{
var unmarshaller = PayloadWithXmlNamespaceUnmarshaller.Instance;
response.Nested = unmarshaller.Unmarshall(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ public IRequest Marshall(NestedXmlMapsRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}
}
if(publicRequest.IsSetNestedMap())
{
xmlWriter.WriteStartElement("nestedMap");
foreach (var kvp in publicRequest.NestedMap)
{
Expand All @@ -97,6 +98,7 @@ public IRequest Marshall(NestedXmlMapsRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}

xmlWriter.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public IRequest Marshall(XmlEmptyMapsRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}

xmlWriter.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public IRequest Marshall(XmlEnumsRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}
var publicRequestFooEnumSet = publicRequest.FooEnumSet;
if (publicRequestFooEnumSet != null && publicRequestFooEnumSet.Count > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public IRequest Marshall(XmlIntEnumsRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}
var publicRequestIntEnumSet = publicRequest.IntEnumSet;
if (publicRequestIntEnumSet != null && publicRequestIntEnumSet.Count > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public IRequest Marshall(XmlMapWithXmlNamespaceRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}

xmlWriter.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public IRequest Marshall(XmlMapsRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}

xmlWriter.WriteEndElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public IRequest Marshall(XmlMapsXmlNameRequest publicRequest)
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}

xmlWriter.WriteEndElement();
}
Expand Down