Concept Summary
I hope you have a clear understanding of service orientation from this section of this chapter. In the next few chapters, let's look at how these concepts work in a WCF system. In our example, I talk about building a simple order Processing service that accepts customer orders. To keep the concept simple and straightforward, there are 2 message participants, as shown in Figure 2-3.
Figure 2-3: A simple example of a message exchange
The purpose of this sample code is to enhance your knowledge of the service and provide WCF introductions, not to describe all aspects of WCF or to establish a complete functional order processing system. The type and mechanism in the example will be described in detail in this book.
Contract
Obviously, service-oriented system development should first be to create a contract. For the simple example, an order contains a product ID, a quantity (quantity), and a status message. With these three fields, an order can be represented using the following pseudo schema code:
<Order>
<ProdID>xs:integer</ProdID>
<Qty>xs:integer</Qty>
<Status>xs:string</Status>
</Order>
From our message autonomy and configuration address discussion, we know that messages require more address structures if we want to use ws-addressing. In our Order Processing service, message senders and receivers uniformly use SOAP messages that adhere to the Ws-addressing specification to restrict the structure of the message. With this rule, here is an example of a reasonably structured message:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap- envelope" xmlns:wsa="http://
schemas.xmlsoap.org/ws/2004/08/addressing">
<s:Header>
<wsa:Action s:mustUnderstand="1">urn:SubmitOrder</wsa:Action>
<wsa:MessageID>4</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
</wsa:Address>
</wsa:ReplyTo>
<wsa:To s:mustUnderstand="1">http://localhost:8000/Order</wsa:To>
</s:Header>
<s:Body>
<Order>
<ProdID>6</ProdID>
<Qty>6</Qty>
<Status>order placed</Status>
</Order>
</s:Body>
</s:Envelope>