Custom Extension XML

Home Page Forums BizTalk 2004 – BizTalk 2010 Custom Extension XML

Viewing 1 reply thread
  • Author
    Posts
    • #25655

      Can I use the “Custom Extension XML” file in the grid properties without using custom XSLT?

      I have a scripting functoid (xslt call template) which is trying to call a method within an assembly. The assembly has a strong name and is in the GAC.

      This is my XSLT Call Template:

      <xsl:template name=”Immo_Art”>
      <xsl:param name=”isWAZ” select=”WAZ”/>
      <xsl:param name=”grundst_typ” select=”grundst_Typ”/>
      <xsl:param name=”sonstige_typ” select=”sonstige_Typ”/>
      <xsl:variable name=”objektart_nr” select=”/Immobilie/objektkategorie/objektart/child::node()[1]”/>
      <xsl:element name=”Immobilienart”>
      <xsl:variable name=”var:v1″ xmlns:ScriptNS1=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS1” select=”ScriptNS1:IWImportObjekt($objektart_nr, $grundst_typ, $sonstige_typ, $isWAZ)” />
      <xsl:value-of select=”$var:v1″ />
      </xsl:element>
      </xsl:template>

      My Custom Extension XML:

      <ExtensionObjects>
        <ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS1” AssemblyName=”IWXSLTImportAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dae71e556e8249f5″ ClassName=”IWImportAssembly.IWObjektImport” />
      </ExtensionObjects>

      But I get the following error message when I try to test my map:

      Error 11 XSL transform error: Unable to write output instance to the following <file:///C:\Users\ASlupianek\AppData\Local\Temp\_MapData\IWMappingOpenImmo_to_IW\IWMappingOI_to_IW_output.xml>. Cannot find the script or external object that implements prefix ‘ScriptNS1’. C:\Users\ASlupianek\Documents\Visual Studio 2010\Projects\IWMappingOpenImmo_to_IW\IWMappingOpenImmo_to_IW\IWMappingOI_to_IW.btm 1 1 

      What am I doing wrong? ;(

    • #25656

      You forgot to add prefix in template name line.

      Check post "mapping" from yesterday

      • #25662

        Now my xslt call template scripting functoid looks like this:

        <xsl:template name=”Immo_Art” xmlns:IWObjektImport=”urn:external:assembly:functions”>
        <xsl:param name=”isWAZ” select=”WAZ”/>
        <xsl:param name=”grundst_typ” select=”grundst_Typ”/>
        <xsl:param name=”sonstige_typ” select=”sonstige_Typ”/>
        <xsl:variable name=”objektart_nr” select=”/Immobilie/objektkategorie/objektart/child::node()[1]”/>
        <xsl:element name=”Immobilienart”>
        <xsl:variable name=”var:v1″  select=”IWObjektImport:IWImportObjekt($objektart_nr, $grundst_typ, $sonstige_typ, $isWAZ)” />
        <xsl:value-of select=”$var:v1″ />
        </xsl:element>
        </xsl:template>

        And my Custom Extension XML file like this:

        <ExtensionObjects>
          <ExtensionObject Namespace=”urn:external:assembly:functions” AssemblyName=”XSLT_External_Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5b7d5a4522ce583″ ClassName=”IWImportAssembly.IWObjektImport”/>
        </ExtensionObjects>

        But the compiler still cant find the prefix:

        Cannot find the script or external object that implements prefix ‘IWObjektImport’.

         

        Argh!!!

        And I dont use an external custom xslt file.

        • #25663

          You are missing the a bit of the assembly name:
          It should look something like this::  IWImportAssembly, XSLT_External_Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5b7d5a4522ce583

          Note: the namespace used in the previous post was just an example, each assembly in the extensions xml file needs to have it’s own namespace. I would suggest using a better namespace that reflects your environment. The urn style is just a personal preference, the namespace can be any unique string e.g. urn:yourcompany.com:utilities:objektimport or http://yourcompany.com/Utilities/ObjektImport

           

          • #25664

            Hey Greg, thanks for your help!!

            But I still get the same error message:

            Cannot find the script or external object that implements prefix ‘IWObjektImport’.

            It`s like he doesnt recognize the custoum extension xml file:

            <ExtensionObjects>
              <ExtensionObject Namespace=”http://immowelt.de/Import/ObjektImport” AssemblyName=”IWImportAssembly, XSLT_External_Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5b7d5a4522ce583″ ClassName=”IWImportAssembly.IWObjektImport”/>
            </ExtensionObjects>

            I tried everything you guys told me to do. I`m stuck.

            • #25666

              Sorry my last post was completely wrong. You only need to specify the assembly name:

              <ExtensionObject Namespace=”http://immowelt.de/Import/ObjektImport” AssemblyName=”XSLT_External_Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5b7d5a4522ce583″ ClassName=”IWImportAssembly.IWObjektImport”/>

              Is your XSLT_External_Assembly in the GAC?
              Are you referencing this assembly in your BizTalk project – you should not. If you are remove the reference, add the assmbly to the GAC and restart Visual Studio.

              • #25677

                Hi Greg!

                I am referencing this assembly in my BizTalk project. (it is in the GAC). Now My Extension XML looks like this:

                <ExtensionObjects>
                  <ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS0” AssemblyName=”IWImportAssembly, Version=1.0.3883.17877, Culture=neutral, PublicKeyToken=351babac2ee00600″ ClassName=”IWImportAssembly.Objektart” />
                  <ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS1” AssemblyName=”IWImportAssembly, Version=1.0.3883.17877, Culture=neutral, PublicKeyToken=351babac2ee00600″ ClassName=”IWImportAssembly.ISO_LAND” />
                  <ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS2” AssemblyName=”IWImportAssembly, Version=1.0.3883.17877, Culture=neutral, PublicKeyToken=351babac2ee00600″ ClassName=”IWImportAssembly.GeoDaten” />
                  <ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS3” AssemblyName=”IWImportAssembly, Version=1.0.3883.17877, Culture=neutral, PublicKeyToken=351babac2ee00600″ ClassName=”IWImportAssembly.IWObjektImport” />
                </ExtensionObjects>

                My Call Template script functoid:

                <xsl:template name=”Immo_Art” xmlns:ScriptNS3=http://schemas.microsoft.com/BizTalk/2003/ScriptNS3>
                <xsl:param name=”isWAZ” select=”WAZ”/>
                <xsl:param name=”grundst_typ” select=”grundst_Typ”/>
                <xsl:param name=”sonstige_typ” select=”sonstige_Typ”/>
                <xsl:variable name=”objektart_nr” select=”/Immobilie/objektkategorie/objektart/child::node()[1]”/>
                <xsl:element name=”Immobilienart”>
                <xsl:variable name=”var:v1″  select=”ScriptNS3:IWImportObjekt($objektart_nr, $grundst_typ, $sonstige_typ, $isWAZ)” />
                <xsl:value-of select=”$var:v1″ />
                </xsl:element>
                </xsl:template>

                And this is the new error message I get:

                ‘IWImportObjekt()’ is an unknown XSLT function.

                I feel it. I am coming closer to the solution 😉

                 

                P.S.: When I remove the referenced assembly in my biztalk project I get this:

                Cannot find the script or external object that implements prefix ‘ScriptNS3’.

                • #25679

                  I notice IWObjektImport is the class name, what is  the method name you wish to call?
                  Also does IWObjektImport have a default constructor?
                  You class library should look something like this:
                  namespace IWImportAssembly
                  {
                      public class IWObjektImport
                      {
                          public static string SomeMethod(string  p1, string p2, string p3, string p4)
                          {
                          }
                      }
                  }

                  And Your xpath should be:
                  <xsl:variable name=”var:v1″  select=”ScriptNS3:SomeMethod($objektart_nr, $grundst_typ, $sonstige_typ, $isWAZ)” />

                  • #25683

                    hey greg, I found out that custom extension xml works only with custom xslt path.

                    i tried out the xslt file, which was generated by validate map, in custom xslt path. And there is an attribute field which looks like this (in the *.btm file):

                    <CustomXSLT XsltPath=”..\..\..\..\..\AppData\Local\Temp\_MapData\IWMappingOpenImmo_to_IW\IWMappingOI_to_IW.xsl” ExtObjXmlPath=”.\IWMappingOI_to_IW_extxml.xml” />

                    So I believe that the custom extension xml file works only if you work with your own xslt file. But I dont. I am working with the xslt file generated by VS2010.

                    • #25687

                      Where did you save your external xml file? I’m working with VS2005 and saved xml file in the same project where I have external assembly. In the map just click custom extension xml in the properties and find your file. Works for me.

                      • #25692

                        This definitely works, I have an example I have created. The CustomXslt tag in the .btm file looks like this when not using a custom Xslt file, just the extensions file:
                        <CustomXSLT XsltPath=”” ExtObjXmlPath=”.\extension.functions.xml” />

                        Typically I put the extensions file in the same project directory as the map and add it to the project. This is so it is maintained under source control

                      • #25695

                        Ok, but when I add the path to my custom extension xml file within the grid properties. I dont get a tag like yours. Even when I rebuild the project. Evertytime when I close/open VS2010 I have to add the path back again. It seems my project doesnt save the changes to grid properties. This only worked out for me with custom xslt and custom extension xml.

                        This is the message I get when I use custom xslt and custom extension xml:

                        C:\Users\ASlupianek\Documents\Visual Studio 2010\Projects\…..\……\IWMappingOI_to_IW.btm: The compilation is using the CustomXslt and CustomExtensionXml tags to generate the output. The map content is ignored.

                        When I try to build the project only with custom extension xml I dont get a message like this. No “The compilation is using the customextensionxml tag to…. I have no CustomExtensionXml tag in my *.btm.

                        When I search for “Custom” within my *.btm file I cant find any results. Man this is strange. Why do you have a “CustomXSLT” tag and I dont? I have my ExternalAssembly.xml in the same project directory and it is included in my project. But nethertheless I dont get a “CustomXSLT” tag….

                      • #25696

                        When I add this line at the right place within my *.btm by myself:

                        <CustomXSLT XsltPath=”” ExtObjXmlPath=”.\ExternalAssembly.xml” />

                        I get the following error message:

                        Item has already been added. Key in dictionary: ‘http://schemas.microsoft.com/BizTalk/2003/ScriptNS0’&nbsp; Key being added: ‘http://schemas.microsoft.com/BizTalk/2003/ScriptNS0&#8217;

                      • #25705

                        Sounds like you have a namespace clash.
                        You need to define namespaces that are not used by anything else. using your own domain name should he help:
                        e.g. urn:yourcompany.com:utilities:objektimport or http://yourcompany.com/Utilities/ObjektImport

                      • #25707

                        It works but only when I write this <CustomXSLT XsltPath=””
                        ExtObjXmlPath=”.\ExternalAssembly.xml” /> to my Map file by hand (*.btm) and
                        save the changes.

                        When changes are saved and I test my map with “Test Map” I see this “The compilation is using the CustomExtensionXml tag (specified in the Grid properties) along with the ExtensionXml that is produced by the map content.” in my output window.

                        VS2010 doesnt save the changes when I type the full
                        path name of the file (AssemblyExternal.xml) in the Custom
                        Extension XML
                        property. The full path name of my
                        custom extension xml file is also gone when I restart VS2010 or when I
                        open/close *.btm with XML Editor.

                        Like I said it works only when
                        adding by hand. Is this a bug? I am using BizTalk 2010 Beta.

                      • #25722

                        Took me  a while to rebuild my 2010 environment with the latest BizTalk 2010 beta.
                        You are right, I get the same behaviour in this environment, definitely looks like a bug with the beta. this is a bug in the beta

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.