Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i'm new with c# and web service, trying to read the xml Soap request but the intelligence keeps saying it's not right... i'm out of idea... please help!!
here's client xml request, I removed duplicate items for easy read:
XML
<pre><tem:Request>
	<pix:cname>Testaccount</pix:cname>
	<pix:sclass>sales</pix:sclass>
	<pix:PO>PO12345</pix:PO>
	<pix:method>AIR</pix:method>
	<pix:product>
		<pix:style>Abc1</pix:style>
		<pix:qty>1</pix:qty>
		<pix:price>1.00</pix:price>
	</pix:product>
	<pix:product>
		<pix:style>Cde1</pix:style>
		<pix:qty>2</pix:qty>
		<pix:price>1.00</pix:price>
	</pix:product>
</tem:Request>


I have 2 classes:
class order
C#
<pre>[MessageBodyMember(Order = 0)]
	public string wsVersion { get; set; }
	[MessageBodyMember(Order = 1)]
	public string cname { get; set; }
	[MessageBodyMember(Order = 2)]
	public string PO { get; set; }
	[MessageBodyMember(Order = 3)]
	public string method { get; set; }
	[MessageBodyMember(Order = 4)]
	[XmlArrayItem("oItems", IsNullable = false)]
	public Item[] Items { get; set; }


class Item
C#
<pre>	[XmlElement(Order = 0)]
	public string style { get; set; }
	[XmlElement(Order = 1)]
	public int qty { get; set; }
	[XmlElement(Order = 2)]
	public double price { get; set; }


in service.svc.cs
C#
<pre>wsVersion = httpUtility.HtmlEncode(request.wsVersion);
cname= httpUtility.HtmlEncode(request.cname);
PO= httpUtility.HtmlEncode(request.PO);
method= httpUtility.HtmlEncode(request.method); //<-- no problems

items = new Item();
listItem = new List<Item>();
listItem.style = HttpUtility.HtmlEncode(request.item.style());  //<-- stuck



thank you in advance!!

What I have tried:

C#
listItem = HttpUtility.HtmlAttributeEncode(SerializableAttribute.GetCustomAttributes.items());
//GetCustomAttributes not right
//tried xmlNodeList but don't know how to read xml request, can do in xml file
Posted
Comments
j snooze 10-Jul-18 17:15pm    
are you missing the closing pre tag, or did you just omit that from the xml posted? Every tag needs and open and a closing tag for valid xml.
newccif 13-Jul-18 12:35pm    
thank you for your reply.
i use SoapUI to test the service, so i assumed the tags are closed properly...
=(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900