Problems may occur when you try to integrate an InfoPath 2003 Form with BizTalk 2002 (823435)
The information in this article applies to:
- Microsoft Office InfoPath 2003
- Microsoft BizTalk Server 2002
- Microsoft BizTalk Server 2002 SP1
SYMPTOMSWhen you try
to use Microsoft Office InfoPath 2003 to submit XML data to a Microsoft BizTalk 2002
Server application, the following problems may occur:
CAUSEThese
problems occur because of the way that BizTalk 2002 handles XML data when BizTalk 2002 validates the XML data. The structure of the XML data in BizTalk 2002 can be described either by the XML-Data Reduced schema (XDR) format or by the Document
Type Definition (DTD) schema format. Both the XDR format and the DTD format have
been replaced by the industry-standard XML Structure Definition (XSD) format. InfoPath 2003 uses the XSD format. Because there are differences in how the DTD schema format, the XDR schema format, and the XSD schema format describe the structure of the XML data, the InfoPath 2003 XML data is incompatible with BizTalk 2002 if the XML data is not modified. Additionally, InfoPath 2003 uses XML processing instructions that are not supported by BizTalk 2002.RESOLUTIONTo 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 componentTo 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. STATUS This behavior is by
design.
Modification Type: | Minor | Last Reviewed: | 7/28/2006 |
---|
Keywords: | kbprb KB823435 kbAudDeveloper |
---|
|