Sunday, March 13, 2005

Hacking files in BizTalk

The previous post on Sql debatching mentioned 'hacking' auto-generated files, something that may alarm some people (though not many, if my experience of developers is anything to go by.)

Another example of this is the extraction of primitive values from auto-generated schemas, specifically (in my case) consumed web service responses. As an example, say that you consume a web service that returns a single value (acknowledgement id, boolean flag indicating that an update went through, you know the sort of thing.) Because these values are contained within the auto-generated reference.xsd files they are neither promoted (in fact they couldn't be promoted, as only passthru pipelines are supported for SOAP calls) nor distinguished, and therefore not immediately accessible within expression or assignment shapes.

I think the documentation, if there were any, would suggest using the xpath function to extract the values, but being lazy I find it easier to simply find the relevant reference.xsd schema definition and make the propert distinguished just as you would with your own schema. The danger with this is that the distinguished property status is lost if you refresh the web reference.

However, and this to me is the distinction between good and bad practice, this would cause a compile-time error, and would therefore have to be fixed before being redeployed. It'll never cause a runtime exception, and so this does not strike me as bad practice. It's just a shortcut, which in my book is a Good Thing.

No comments: