![]() ![]() We first take the template name and expand it to include the full namespace to the Embedded Resource I like to keep all my schemas in the same directory and so the namespace reflects this. ( " // end private static stream GetRequest TransactionId = () ĪuthenticationValue = EncodePassword( String.Format ![]() SenderPassword = RoleEnvironment.GetConfigurationSettingValue( " SenderPassword") SenderID = RoleEnvironment.GetConfigurationSettingValue( " SenderId") AuthenticationValue – authenticates the requestīecause these properties are unique to the Companies House message, and because they are shared with all messages, they are perfect candidates for a base class.TransactionId – unique identifier for the message.SenderPassword – the password associated with Id.SenderId – the id of the person sending the message.However, there are common properties in all the messages that we send to Companies House. To start, we need to create an object which will represent the contents of the message we are sending. What makes it possible is the use of XSLT to define the message – and serialization to convert each request object into XML. This is the XML that we send to the GovTalk Service and we get back a list of companies that match the criteria passed.Ī message is structured in two parts The envelope which identifies the person sending the request, with the name of the request, and the body which gives the detail of the company we are looking for. 1.0 NumberSearch request 1 ? CHMD5 ? 99999999 LIVE 1 The request to search for a company based on its number is as follows: It is a bit like Sweet Chilli Sauce added to Chicken on a bed of rice. The magic sauce in this is the XSLT which defines the structure of the request, and the use of objects in conjunction with reflection to provide the content. The C# functions which send and receive the messages remain the same. For the purposes of this article, I am going to be using the CompanyNumberSearch request of the GovTalk service – although this technique would work for any service that accepted XML. So the following is a somewhat better way of achieving the same thing. This is OK for the short term, but the biggest cost in any software project is maintenance and this would be a headache to maintain. While this worked, it left a number of problems not least that for every message a special function would need to created. The way I previously created messages to send to the GovTalk service is I used the XMLDocument to create the request.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |