At TechEd in Orlando a few weeks ago, I did a demostration of how InfoPath can be used as an easy client for submitting XML documents to Dynamics AX. The only glue you need to provide is a simple web service that pushes the XML document into the business connector, as shown below:
You install this as a web service, and then simply tell Infopath to submit its captured data to it. I think you'll agree that there's nothing really revolutionary about that code. It's pretty standard in the way it uses the business connector to gain access to a class, posting the incoming document into Dynamics AX (through the TravelExpense static method). For your reference, I'm listing the content of that method below for your reading pleasure(?) Please bear in mind that this is definitely NOT poduction code (it was written in the conference dinner hall before the session in which it was used), but it does show some interesting techniques in dealing with XML documents.
}
For the sake of completeness, I'm including the XML file that InfoPath generates:
<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.4" productVersion="12.0.0" PIVersion="1.0.0.0" href="file:///C:\Users\pvillads\Desktop\TravelExpenseTemplate.xsn" name="urn:schemas-microsoft-com:office:infopath:TravelExpenseTemplate:-myXSD-2005-10-21T21-12-27" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?><my:travelRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://www.villadsen.dk/ConsumesInfopath" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-10-21T21:12:27" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us"> <my:purpose>TechEd 2007</my:purpose> <my:requestDate>2007-06-28</my:requestDate> <my:name>Peter Villadsen</my:name> <my:email>pvillads@microsoft.com</my:email> <my:trips> <my:trip> <my:departureLocation>Seattle, SEATAC</my:departureLocation> <my:destination>Orlando International</my:destination> <my:departureDate>2007-06-28</my:departureDate> <my:departureTime>Anytime</my:departureTime> <my:isRoundTrip>false</my:isRoundTrip> <my:roundTrip> <my:returnDate xsi:nil="true"></my:returnDate> <my:returnTime>Anytime</my:returnTime> </my:roundTrip> <my:includeHotel>true</my:includeHotel> <my:includeCar>false</my:includeCar> </my:trip> </my:trips> <my:preferences> <my:tripClass>Economy / Coach</my:tripClass> <my:seatLocation>Aisle</my:seatLocation> <my:carClass></my:carClass> <my:nonSmokingRoom>true</my:nonSmokingRoom> </my:preferences> <my:notes>Need to book this ASAP please</my:notes> <my:filterDepartureLocation></my:filterDepartureLocation> <my:filterDestination></my:filterDestination> <my:filterDepartureDate></my:filterDepartureDate></my:travelRequest>