Udostępnij za pośrednictwem


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="https://www.w3.org/2001/XMLSchema-instance"

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

            xmlns:soap="https://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

  • Anonymous
    March 03, 2004
    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...
  • Anonymous
    March 03, 2004
    The comment has been removed