BizTalk Gurus

Orchestration calling .net

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 1 Follower

Top 10 Contributor
185 Posts
Siva posted on Thu, Jan 28 2010 2:15 PM

Hi,

I am working on price and availability project. I will get the item number and vendor, who has those item, from back end system. I have stored vendor information, who support P&A, in a xml config file. I need to check the config file to see does this vendor support P&A. If it does then I need to send the request to vendor and get the response from them. I need to modify the warehouse information in response message using the config file.

For this, I have an orchestration and Serializable C# class. C# class has a constructor where I load config file to globale xmlDocument type variable cfg, Boolean type method(doesSupport) to check does vendor exist in config file and , Response Message type method(updateResponse)  to modify the response message. I used the xsd.exe to create Response Message type class. I have [NonSerialized] just before the xmlDocument cfg declaration.

Orchestration get the request. In Expression shape I initialized c# class, vendorCheck, and  then calls  doesSupport method. If it returns false then terminate the orchestration.   Else send request and receive response from vendor. Now, call updateResponse to modify the response.

updateResponse method is throwing “NullReferenceException: Object reference not set to an instance of an object. “ Error when the orchestration runs first time. This happens when cfg.selectsinglenode method execute because cfg is null. However I have already initialized the cfg in constructor earlier. doesSupport, which uses same cfg, didn’t throw any error.  It works fine after the first request. So If I restart the BizTalkHost then I get same error on first call.

How can I fix the this issue?

I cannot use static cfg or static class since I will get many concurrent call at same time.

Here each orchestration will have its own instance of vendorCheck. So no need to worry about concurrent calls or multi threading. Please correct me if i am wrong here.

 

 

Thank you, Siva

All Replies

Top 10 Contributor
483 Posts
xman71 replied on Mon, Feb 22 2010 11:19 AM

Hi Siva,

 

   It seems to me that this this a scoping definition issue with your variable cfg in your orchestration... Try to define this variable at the orchestration level and see if that fixes your Null Reference Exception errors.

 

   Daniel.

 

"Google skills are more important than your coding skills."

Page 1 of 1 (2 items) | RSS