Serialisation, mixed content and string[]

When you generate a class out of a schema with an element configured to allow mixed content (child attributes and elements as well as text), you should expect the corresponding generated field type to be a string array;

So – if you have a schema that looks like this

<?xml version=”1.0″ encoding=”utf-8″?>
<
xs:schema targetNamespace=”http://tempuri.org/XMLSchema.xsd” elementFormDefault=”qualified” xmlns=”http://tempuri.org/XMLSchema.xsd” xmlns:mstns=”http://tempuri.org/XMLSchema.xsd”
xmlns:xs=”http://www.w3.org/2001/XMLSchema”>
<
xs:element name=”SomeElement”>
<
xs:complexType mixed=”true”>
<
xs:sequence>
<
xs:element name=”Child1″ type=”xs:string”/>
<
xs:element name=”Child2″ type=”xs:string”/>
<
xs:element name=”Child3″ type=”xs:string”/>
</
xs:sequence>
<
xs:attribute name=”SomeAttribute” type=”xs:string”/>
</
xs:complexType>
</
xs:element>
</
xs:schema>

(not ’SomeElement’ being a complex type allowing mixed content)

The fields in the generated class would look like

public partial class SomeElement {
 
 private string child1Field;
 
 private string child2Field;
 
 private string child3Field;
 
 private string[] textField;
 
 private string someAttributeField;
.
.
.

The reason is that an XML corresponding to the schema might look like this –

<SomeElement xmlns="http://tempuri.org/XMLSchema.xsd" SomeAttribute="someAttributeValue">
 Some free text
 <Child1>Child1 text</Child1>
 Some more free text
 <Child2>Child2 text</Child2>
 yet some more free text
 <Child3>Child3 text</Child3>
</SomeElement>

And so by using a string array to hold the text the deserialiser can keep string portion separately.

Initially, I thought, this allows the structure to represent the original xml accurately, but this is not exactly the case – you would still not know for certain where each string portion existed, especially if in the source XML you get a few elements that don’t have text between them, which , I suspect, is why when I serialise the instance back to xml I actually get –

<?xml version="1.0"?>
<SomeElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SomeAttribute="someAttributeValue" xmlns="http://tempuri.org/XMLSchema.xsd">
 <Child1>Child1 text</Child1>
 <Child2>Child2 text</Child2>
 <Child3>Child3 text</Child3>
 Some free text
 
 Some more free text
 
 yet some more free text
 </SomeElement>

Now, I don’t particularly like this sort of xml, and shy away from mixed content; I don’t believe that xml snippets like my samples above are useful, specifically I don’t think that mixing elements and text is particularly nice.

However, consider an element with an attribute and some text – the following is quite reasonable I think, and yet requires mixed content –

<Phone type=”mobile”>some text here</Phone>

Microsoft ESB Guidance installation

I just installed Microsoft Enterprise Service Bus Guidance framework (November 2007 version for BizTalk 2006 R2). Although lengthy installation process is well documented in the accompanying help file I ran into multiple issues and it took a couple of days to sort everything out.I’d like to mention here majorproblems/solutions in case somebody decides to go through the same.First, if you install on other than default location (C:/%PROGRAM_FILES% and C:/Projects)make sureto update all scripts and command files as well as bindings.Second, I had issue withUDDI service configuration. It wouldn’t install until I enabled NTLM authentication for IIS.It is done by executing IIS utility scriptper this MS article. But thiscommand workedonly when I dropped quotes around Negotiate,NTLM contrary to MS KB article. Also,make sure the default web site ID is “1”. Some of my computers had it set to different numbers so I had to change command line appropriately. In the end command that worked looks like this:

cscript adsutil.vbs get w3svc/<Default Web Site ID>/root/NTAuthenticationProviders Negotiate,NTLM

Anotherproblem is that assemblies in MSI packagesare signed with different key comparing to source projects. So even if you install all ESB componentsfrom source you will run into this issue because some of the projects reference assemblies from packaged installation. Solution is to go through all project references, remove them and add new to ones generated from source code. The same applies to sample applications. Don’t install them from MSI if you chose source code based ESB installation. Open project, update references, rebuild and deploy.

MVP Summit 2009 – The Official Plan

The time is nearly upon us for the Microsoft MVP Summit 2009 in Redmond, WA.  I’m thrilled to be attending this event again, and thankful to Microsoft for the invite.  The Summit is a great time to catch up with fellow MVPs from around the world, but to do that you need to be reachable.  As such, this is the Official Plan for where I’ll be during the conference (all times are PST).

This is not a finished plan, check back here as my schedule evolves.

  • Sunday March 1st, 2009
    • 10:30am : Flight lands at SEA
    • 4pm-5pm : Summit Welcome and Keynote
    • Party with Palermo – Jeffery puts on a GREAT party where ever they happen, and I’m thrilled to attend the PDC version this year.
  • Monday March 2nd, 2009
    • 9am : CSD/BizTalk: Oslo Session
    • 11am : CSD/BizTalk: Oslo Session
    • 1:30pm : CSD/BizTalk: BizTalk Session
    • 3:30pm : CSD/BizTalk: WCF Session
    • Party @ Chez Neward’s
  • Tuesday March 3rd, 2009
    • 9am : CSD/BizTalk: Dublin Session
    • 10:45am : VB/C#: Business Application Development
    • 12:00pm : VB/C#: Recap
    • 1:30pm : VB/C#: Azure Session
    • 2:45pm : VB/C#: Concurrent Programming
    • 5:00pm : VB/C#: Performance Analysis Session
    • EMP Party
  • Wednesday March 4th, 2009
    • 9am-1pm : Keynotes
    • Geek Dinner in Seattle
DevDays09: Wrap Up

DevDays09: Wrap Up

This year the usual TechDays event focused exclusivelly on Dev contents, and reduced to two days. I was help at IST’s campus on Tagus, a smaller but also cosier space. I did three sessions, all of them on the ARChitecture track:

ARC206 Patterns & Anti-Patterns. I did this session together with Tiago Pascoal, and we mostly talked about Architectural Anti-Patterns (and not Patterns/Design Patterns), in a Developer-oriented session. The original TechEd EMEA 2008 session we based it off was one of the best I’ve seen yet, at and I think we managed to surpass the original delivery and contents with examples and real-life experiences.  We had very good feedback on this session.

ARC208 O que h%u00e1 de novo no BizTalk 2009. I do one of these every two years :-). It’s a difficult session to do, because the next release of BizTalk Server has mostly small incremental features, and because there are lots of them. I did two demos, of the developer experience and the new Sql Adapter, to break the sequence of slides, and also mentioned the ESB Guidance 2.0, the relationship with Dublin, and the ISV Royalties program.

ARC209 Windows Azure – Introdu%u00e7%u00e3o aos .Net Services. This session was similar to my presentation last year on this same topic (when it was still called “BizTalk Services”), but with more deep technical content and demos. The main host of the session was Pedro F%u00e9lix, I mostly did the connection to real-life use cases, some clarifications, and the final segment on hosted Workflow, the third component (with the Access Control and Service Bus) of .Net Services. This session had a very high rating.

All the presentations are available here for download in PDF format at my Skydrive.

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

Useful Tooltip in the BizTalk Admin Console with Badly Encoded Messages

Originally posted by Nick Heppleston at: http://www.modhul.com/2009/02/20/useful-tooltip-in-the-biztalk-admin-console-with-badly-encoded-messages/
I noticed a new tooltip yesterday in the BizTalk Admin Console when a message had failed in the Receive Pipeline because of unexpected characters in the message (and because no encoding had been set in the Xml declaration). Interesting to see that the message body text view recognises that […]

BizTalk 2009 training in Beijing and below Zero temperatures

What a week it has been folks – I left Sydney in 30C degrees with sun, sand and beaches…..I
thought “How cold can it be?” (you never really get that appreciation till you hit
the ground)>

Cold….very cold!!! Now I’ve been skiing many times, but this was just something
else.

It caused Beijing to be blanketed in snow and very beautiful – What a fantastic place!!!
Definitely a come back place – just nothing like what I expected.

The people so friendly, helpful and always with purpose in their eyes. The food is
some of the freshest I’ve eaten and such healthy diets (steamed cabbage, mushrooms
etc etc) – nothing like the ‘Western Chinese Resturants’ back home 🙂

On to the reason why I was there – Training

I had approx 50 students coming to hear my Chinese English (which I must say is much
better than me listening to them speaking Mandarin) and we covered in-depth BizTalk
2009 agenda

We covered some great material looking into Governance and ESB 2.0 due to hit around
the same time as BTS2009 (June-ish I believe, earlier I’m told)

 
We actually communicated quite well – I played many games and brought over a bunch
of Aussie gifts for them (which consequently we found out were made in China!)

The usual areas of BizTalk were little used previous by students – SSO, Rule
and BAM
. For so little effort there’s so much mileage in these guys.

Training Results

For the training the average mark I received was 8.5/10 across nearly 50 students,
which for my first time in China I was very happy with. The most important thing for
me though is not the marks, but what the students walk away having learnt!

Not all work Play Time

As luck would have it I had an extra day to play on my trip this time – so in negative
degree temps I went to the Center of Beijing and put on my tourist hat and went to
the Forbidden City (& surrounds).

Lastly I learnt many things from my students this week with

1. KFC is a ‘top class’ resturant in Beijing

2. Starbucks is a ‘romantic’ place (where couples go for dates)

If we were on Mythbusters right now……. compared to Sydney – these are Busted!

Getting the product key of a BizTalk installation

Getting the product key of a BizTalk installation

I received an unusual phone call from a co-worker today: he wanted to find out the product key of BizTalk Server 2006 installed on a server (I didn’t go as far as asking why – lost disk probably).
After a few minutes this is where I got to: open regedit and browse to:
HKLM\SOFTWARE\Microsoft\BizTalk Server\3.0\Registration\DigitalProductID
Now download something […]

Adapter Pack 2.0 Beta released

Hi all,


 We are pleased to announce the release of the Adapter Pack 2.0 Beta.As this is a public beta, customers can also download a 120 day evaluation version here .The features we added are listed below in brief . In addition, we are shipping a free to use migration tool which will help users migrate their projects which used older adapters to the Adapter Pack adapters (details below)


 


 


Oracle EBS


%u00b7         64 bit support


%u00b7         Synonyms


%u00b7         Added performance counters


%u00b7         Notification support


 


OracleDB


%u00b7         64 bit support


%u00b7         Synonyms


%u00b7         UDTs


%u00b7         Notifications


%u00b7         Polling stored procedures


%u00b7         Performance counters


 


 


Adapter SDK


%u00b7         Display complex binding properties 


%u00b7         Display metadata wsdl in web control


 


SAP data provider


%u00b7         Support for more operators in Sap Queries


%u00b7         SAP SSRS support in VS2008


 


Samples


%u00b7         New Samples for SQL and Oracle eBiz Adapters


 


 


The BizTalk Adapter Pack Migration Tool  is a utility that helps developers migrate BizTalk projects using the  BizTalk 2006 SQL or the BizTalk Adapter v2.0 for mySAP Business Suite to their corresponding WCF-based versions from BizTalk Adapter Pack v2!


 


With the help of this utility you will be able to compile and deploy your application within minutes. Some of the highlights for the Migration Tool are:




  • Works on the source project files


  •   Generates equivalent schema definitions for the operations used in the existing project


  •   Generates new maps to convert messages from older formats to the new format


  •   Modifies any existing maps to work with the new schemas


  •   A new project is created upon completion, which uses the SQL and/or SAP adapters from the BizTalk Adapter Pack v2

 


The tool works for most common scenarios of maps and orchestrations, however it is only meant to be a starting step towards migration to BAP and we are open to receiving feedback to add scenarios,.

BizTalk Hotrod Article Published


The latest edition of the BizTalk Hotrod magazine was just released. 


They are currently going through a membership update and if you did not get an e-mail letting you know the latest version was released then subscribe by sending an e-mail to the editor.


You can download the latest edition at http://biztalkhotrod.com/Documents/BizTalk%20HotRod%20Magazine%20Q1%202009.pdf


Be sure to check out my article titled: Application Servers: BizTalk vs. Dublin