WCF service with list array request

Hi,

i'm newbie in C# and web service but i need to read the soap service (xml format) and save it to a SQL tables (dataset)...

here's my client's data:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pix="">
      <soapenv:Header/>
      <soapenv:Body>
            <tem:Request>
                  <pix:wsVersion>v1.2.1</pix:wsVersion>
                  <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>
      </soapenv:Body>
</soapenv:Envelope>

I have 2 classes:
class order
            [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
            [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

wsVersion = httpUtility.HtmlEncode(request.wsVersion);
cname= httpUtility.HtmlEncode(request.cname);
PO= httpUtility.HtmlEncode(request.PO);
method= httpUtility.HtmlEncode(request.method);

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

i do not know how to read the xml element array, should i just use reader at the very beginning?
can someone give me a hint or something? should i not use httpUtility.HtmlEncode?...

thank you!
IUSRAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,

sorry,but I could not fully understand the question.

Are you developing a WCF service which should get the above SOAP structure?
Or are you consuming another service which returns the above elements?

Thanks for clarification,
Rainer
IUSRAuthor Commented:
Hi Rainer,
yes, i'm developing a WCF service, the client will send me the SOAP structure request and i reply with order number.
but i'm having problem reading the request, i can read the single nodes without any issue but the product array is difficult and i do not know how many items will be.
-i tried xml deserialize the whole request but encounter the "Object reference not set to an instance of an object."
-trying the FastMember from NuGet Packages but the red wavy underline showing my array object is unknown...

any suggestion on how to properly read xml request with array items is greatly appreciate...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WCF

From novice to tech pro — start learning today.