To resolve the problems that may occur between InfoPath 2003 and BizTalk 2002, use the following procedures.
Force InfoPath 2003 to correctly recognize XML data fields in an XSD schema that is exported from BizTalk 2002
- Open the
exported XSD schema in a text editor, such as Notepad.
Notice that BizTalk 2002 incorrectly
marks groups of elements with an <xsd:choice> element instead of
with an <xsd:sequence> element. - Edit the
schema to correct this problem. To do this, follow these steps:
- Locate the following code:
<xsd:element name="Order">
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:element name="OrderID" type="xsd:integer"/>
<xsd:element name="OrderDate" type="xsd:date"/>
<xsd:element name="ShipDate" type="xsd:date"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
- Replace the previous code with the following code:
<xsd:element name="Order">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="OrderID" type="xsd:integer"/>
<xsd:element name="OrderDate" type="xsd:date"/>
<xsd:element name="ShipDate" type="xsd:date"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Resolve the validation error that occurs when you submit the
InfoPath 2003 Form to a BizTalk Receive function
To remove the XML processing
instructions, the namespace declarations, and the
xml:lang
attribute from the XML data, follow these steps:
-
Open a text editor, such as Notepad.
- Create a new file. Name the file RemoveNamespaces.xsl.
- Make sure that the RemoveNamespaces.xsl file contains the following code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<xsl:template match="@xmlns:*"/>
<xsl:template match="@xsi:*"/>
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="">
<xsl:apply-templates select="@*"/>
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name(.)}" namespace="">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@xml:lang"/>
</xsl:stylesheet>
- On the Tools menu, click Resource
Manager in the InfoPath 2003 Form.
- In the Resource Manager dialog box,
click Add, and then locate the RemoveNamespaces.xsl file that you
created in step 2.
- On the
Tools menu, click Submitting Forms.
- Under Submit, click Submit using custom script, and then open Microsoft Script Editor.
- To transform the XML data of the InfoPath 2003 Form and to send the XML data to BizTalk
programmatically, use code that is similar to the
following code in the OnSubmitRequest event:
function XDocument::OnSubmitRequest(eventObj)
{
//This is the BizTalk Receive function URL.
var strUrl="http://myServer/InfoPathHTTPReceive/biztalkhttpreceive.dll";
//Load the XSL transform that will remove the XML namespaces.
var objStyle = new ActiveXObject("Msxml2.DOMDocument.5.0");
objStyle.async = false;
objStyle.load("removeNamespaces.xsl");
//Apply the XSL transform to the XML data.
var newDom = new ActiveXObject("MSXML2.DOMDocument.5.0");
newDom.async = false;
newDom.validateOnParse = false;
XDocument.DOM.transformNodeToObject(objStyle, newDom);
//Post the XML document to strUrl.
var objXmlHttp = new ActiveXObject("MSXML2.XMLHTTP.5.0");
objXmlHttp.open("POST", strUrl, false);
objXMLHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-16");
objXmlHttp.send(newDom.xml);
}
After you remove the XML processing instructions and
the namespace declarations from the InfoPath 2003 XML file, InfoPath 2003 can no longer
recognize the file as a valid InfoPath 2003 Form file. If you must open the XML data in
InfoPath 2003 after you process the data in BizTalk 2002, you must re-insert the processing
instructions and the namespace declarations.
Create a compiled COM component that
can be called from the BizTalk Orchestration Engine component
To re-insert the processing
instructions and the namespace declarations in the InfoPath 2003 XML file, create a compiled COM component that
can be called from the BizTalk Orchestration Engine component. This COM component takes
the unmarked XML data from BizTalk, inserts the InfoPath 2003 processing instructions
in the data, and then returns the resulting XML. The processing instructions that are inserted by this COM component are specific to your particular InfoPath 2003 Form. To determine the information that you must re-insert in the InfoPath 2003 XML file, compare an XML
file that was created by InfoPath 2003 with the XML data output by using the "removeNamespaces.xsl"
transform.