Message Debatching – Values not being mapped in a Transformation – Null Values in Destination Schema


Last week I was getting a response from a service which returned a record. I was simply using xpath function and assigning each record into a destination message. Then I used a transformation shape to map 3 messages source messages to the response message. One of the message was which was assigned a record from the response and the message was being constructed successfully as I was logging the message and saw it in the Orchestration Debugger. But after the Transformation the values were NULL.

map_problem

 All was missing was the namespace in the message and my message type wasn’t correct. If the message types are not correct you will get the following exceptions if you are sending a message to a port. But in my case I wasn’t  🙂

 Inner exception: Received unexpected message type does not match expected type http://Namespace#RootNode. Exception type: UnexpectedMessageTypeException

 Well just give your message the appropriate type and you are done. Well it was simple and it wasted 2 hours of mine 😦


technorati tags :

Parsing BizTalk messages in .NET Components through Orchestration


In most of our orchestrations where we need to parse a message lets say for storing data from the message in a database to loop through the records in the message we use XML Parsing. For that we have XpathNavigator class or we can use XMLDocument SelectNodes method which returns an iterator and we can iterate the records in the XML. But consider a complex XML for eg. If there are many parent child nodes and we have to dig deeper into the nodes come back again to the parent and use nested while loops for parsing the whole XML. Well for a good coder this won’t be much of a problem but like a messy coder like me will run into exceptions and bugs. 🙂

 Well how about if we take advantage of .NET Serialization/Deserialization? We pass the message as an XMLDocument object to our component method as a parameter we deserialize the xmldocument to an object. But wait which object? From where will it class come from? We just need a proxy class of the web message type. The proxy class will contain the web message type and all of its nodes and then we can deserialize the xmldocument object containing the xml into a much managed object which we can iterate easily. You can generate the proxy class from visual studio command prompt and giving the proper switches will create the proxy class.

You can see the MSDN help for more switches of wsdl.

 wsdl /out:[dir]proxy.cs http://localhost/%5Bwebservice URI].asmx?wsdl

 If you notice the webservice URI is missing from the command and we need a wsdl of the web service. A simple workaround for this is in our BizTalk Schema project which contains the type of message (schema) is built and then a web message should be published from the BizTalk Web Services Publishing Wizard. Just build your project and run the wizard. In the first step select the “Publish schemas as web services” option. You will get a tree in the next step and yes the web service requires at least a request and response schemas.

 web_pub_1

 Right click the request schema and select the assembly (This assembly should be your BizTalk schemas project).

 choose_schema

  Select the root node of your schema, in the same way configure the response message as well (of your own choice) and you are done.

 web_pub

 In the next step give the URI of the web service and then the hierarchy in your IIS.

 By running the command given above you will get the proxy class. Include this class in your component project (which will be most likely a .NET library project). (Note: If you don’t see your schema type class in the intellisense, do check the proxy class and your component project namespaces). In your components method which will be parsing your message deserialize your xmldocument object to the object type of the proxy class. This will be the Root node (If you have one) name of your schema. In my case I used the code below. Xdoc is the object variable name of the type XMLDocument which will contain my xml data. And one more thing which I am sure most of the BizTalk guys will know you can assign your message freely to the XMLDocument type variable in your orchestration.

IFX response = new IFX();
XmlSerializer xs = new XmlSerializer(response.GetType());
XmlNodeReader reader = new XmlNodeReader(xdoc.DocumentElement,”Namespace”);
response = (IFX)xs.Deserialize(reader);

In the above code I was receiving a response and wanted to insert the records from the response into my table. This made me comfortably access the inner child records and arrays of the XML. May be you would get xml document runtime errors. Do check your XML that if it contains namespaces then deserialization will give exceptions. For this supply the Namespace of the root node in the XmlNodeReader constructor.


technorati tags :

BizTalk-There was a failure executing the receive pipeline – Attempted to access an unloaded AppDomain


I was redeploying my BizTalk project after making a little changes in my orchestration. I tested my web service and eventually I got the following error in my Error Log.

There was a failure executing the receive pipeline: “Microsoft.BizTalk.DefaultPipelines.PassThruReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35” Source: “Unknown ” Receive Port: “ReceivePortPost1” URI: “/RecRq.asmx” Reason: Attempted to access an unloaded AppDomain.

Well this error occurs when you have published the web services and BizTalk does not recognize the change in the web services. You can reset the IIS and it works. No need to restart the host instances. As a good practice always publish the web services when the orchestrations which are being published as a web service are stopped or in an unlisted state so this error will not occur.

Preserve trailing spaces in flat file schema


If the trailing spaces of your flat file message is being truncated by BizTalk then the workaround to this is add the (pad_char_type=”none” ) attribute to the (schemainfo and fieldinfo) tags.I used the flat file schema wizard to generate the schema. Before modification my schema looked like this.

 

<xs:schema xmlns=“” targetNamespace=” “>

  <xs:annotation>

    <xs:appinfo>

      <b:schemaInfo standard=Flat File codepage=65001 default_pad_char= pad_char_type=char count_positions_by_byte=false parser_optimization=complexity lookahead_depth=3 suppress_empty_nodes=false generate_empty_nodes=true allow_early_termination=true early_terminate_optional_fields=false allow_message_breakup_of_infix_root=false compile_parse_tables=false root_reference=RecordNode />

    </xs:appinfo>

  </xs:annotation>

  <xs:element name=RecordNode>

    <xs:annotation>

      <xs:appinfo>

        <b:recordInfo structure=delimited child_delimiter_type=hex child_delimiter=0xD 0xA child_order=postfix sequence_number=1 preserve_delimiter_for_empty_data=true suppress_trailing_delimiters=false />

      </xs:appinfo>

    </xs:annotation>

    <xs:complexType>

      <xs:sequence>

        <xs:annotation>

          <xs:appinfo>

            <b:groupInfo sequence_number=0 />

          </xs:appinfo>

        </xs:annotation>

        <xs:element maxOccurs=unbounded name=RecordField type=xs:string>

          <xs:annotation>

            <xs:appinfo>

              <b:fieldInfo justification=left sequence_number=1 />

            </xs:appinfo>

          </xs:annotation>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

</xs:schema

 

 

 

 

After modification my schema changed to this.

 

<xs:annotation>

    <xs:appinfo>

     <b:schemaInfo standard=Flat File codepage=65001 pad_char_type=none count_positions_by_byte=false parser_optimization=complexity lookahead_depth=3 suppress_empty_nodes=false generate_empty_nodes=true allow_early_termination=true early_terminate_optional_fields=false allow_message_breakup_of_infix_root=false compile_parse_tables=false root_reference=RecordNode />

    </xs:appinfo>

  </xs:annotation>

  <xs:element name=RecordNode>

    <xs:annotation>

      <xs:appinfo>

        <b:recordInfo structure=delimited child_delimiter_type=hex child_delimiter=0xD 0xA child_order=postfix sequence_number=1 preserve_delimiter_for_empty_data=true suppress_trailing_delimiters=false />

      </xs:appinfo>

    </xs:annotation>

    <xs:complexType>

      <xs:sequence>

        <xs:annotation>

          <xs:appinfo>

            <b:groupInfo sequence_number=0 />

          </xs:appinfo>

        </xs:annotation>

        <xs:element maxOccurs=unbounded name=RecordField type=xs:string>

          <xs:annotation>

            <xs:appinfo>

              <b:fieldInfo justification=left sequence_number=1 pad_char_type=none />

            </xs:appinfo>

          </xs:annotation>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

</xs:schema>

 

BizTalk Error – Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.


The Messaging Engine failed to register the adapter for “SOAP” for the receive location {Location}”. Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

 As this is a permission issue the error occurs because the web service is running on the application pool which security account user is not a member of the BizTalk Isolated Host Users group.

 To solve this issue check the application pool security user account in the IIS. Add that user account into the BizTalk Isolated Host Users group. Or change the application pool to the pool which user is already a member of the BizTalk Isolated Host Users Group.


technorati tags :

Important hotfixes for the biztalk oracle adapter


The important hotfixes that solved most of the problems that we were having are below. You can find all the hotfixes for the oracle adapter on the Microsoft Website.

%d bloggers like this: