Web Services Quiz: Issue 3


This quiz is based on a recently raised customer issue: They’d built a state of the art Web Service infrastructure to transform different parts of their manufacturing system into a standardized service based approach. Since this is an ongoing process, the previous version of their system, an “XML over Http” solution, is still in use. Therefore, the new services have sometimes to deal with XML documents that are based on their “old” system. For simplicity reasons, they just put the root element of these documents into the soap body and send them to the appropriate endpoint. On the other hand, the Web Service implementation just creates the corresponding .NET classes for serializing and deserializing these nodes. Given the following SOAP envelope, do you see any problems in the Web Service implementation below?


My opinion about this issue will follow…


 


<?xml version="1.0" encoding="utf-8"?>


<soap:Envelope


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


            xmlns:xsd="http://www.w3.org/2001/XMLSchema"


            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">


  <soap:Body>


    <request xmlns="uri.beatsch.com/issue3">


      <product Id="5">


        <componets>


          <Item Id="">


            <componets xsi:nil="true" />


          </Item>


          <Item/>


        </componets>


      </product>


      <amount>30</amount>


    </request>


  </soap:Body>


</soap:Envelope>


 


 


public class Item


{


      [XmlAttribute]


      public int Id;


      public Item[] componets;


}


 


public class ChkPrdAvailReq


{


      public Item product;


      public int amount;


}


 


public class ChkPrdAvailResp


{


      public bool available;


}


 


[WebMethod]


[SoapDocumentMethod(ParameterStyle=SoapParameterStyle.Bare)]


public ChkPrdAvailResp CheckProductAvailability(ChkPrdAvailReq request)


{


ChkPrdAvailResp resp = new ChkPrdAvailResp();


// Do something


return resp;


}


 

Comments (2)

  1. Anonymous says:

    I’m glad that I have been working with XML that much in the past 🙂

    But just let the others have fun an play around with that…

  2. Anonymous says:

    <a href="http://blogs.msdn.com/beatsch/archive/2004/02/26/80141.aspx#80585">Considering I love learning</a>, I figured I’d give this another shot…

    In your Item class, you pass along an array of Items, would you not want to add the attribute.. [XmlArray("Components")] to Item[] components.?

Skip to main content