I have an orchestration from where I am calling a .Net library method UpdateReport() which returns an object of type FinalReport. The FinalReport is a serializable class which contains some fields like errorid,errordesc etc.
In this method UpdateReport() I am calling two webservices which updates some data in the database. Now if any exception occurs in the first webservice call or process then I catch that and populate the FinalReport.errorid & FinalReport.errordesc and I am handling this is the catch exception block in c#. However even if the error occurs in the first webservice then the process should continue with calling the second webservice and should only return object of FinalReport after completion of both the webservices or the entire UpdateReport() code block and then return the FinalReport object back to the calling orchestartion for further processing. And if any exception occurs even in the second webservice call then in the calling orchestration I need to get the errorid and errordesc of both the exceptions.
Could you please assist me in how can I handle this.
Thanks
Hi,
The logic of calling the web service ad returning the success message or exception one in case of failure is being implemented in C# assembly within your UpdateReport() method.
There is nothing for BizTalk to do here . You can check the if else condition in your UpdateReport() method. In case of failure message returned from first call, you can have a logic to call the second web service call.
Note : All these logic of calling multiple web services can be implemented easily within BizTalk . You are not fully utilizing the capability of BizTalk as all the processing is being done through external assembly .I would suggest to have a look at your Integration Architecture design pattern to ease the process of supporting the developed artifacts.
Thanks
Abhishek
Hi,
You can try serializing your exception message ex or get the exception property necessary in your Orchestration and bind it to any element of the response object you are sending in the Orchestration .
For this you may need to add extra class variable inside your Orchestration.
Thanks
Abhishek
Thanks again...So I have serialized FinalReport which is the return type of the method inside which the two webservices and other business code is written.
sample pseudo code
public FinalReport UpdateReport()
{
FinalReport frp = new FinalReport()
try
{call webservice1;
frp.errorid=0;//if success}
catch()
{
frp.errorid="something";frp.errordesc = "something"
return frp;
}
try
{call webservice2;
frp.errorid=0;//if success}
catch()
{
frp.errorid="something";frp.errordesc = "something"
return frp;
}
return frp;
}//close method
Now when the FinalReport object frp is returned to BizTalk orchestration I need to do something with the errorids and errordesc (assuming both the webservices has some error and threw execption) so how will I fetch the details of this FinalReport object in the orchestration.
Also as you suggested I can do something like calling the second webservice even from inside the first exception block so as to continue with the method execution even on failure, if that's what you suggested but then how will I access these details in the orchestration.
Try referring to below MSDN article https://msdn.microsoft.com/en-us/library/dszsf989.aspx
You can always have a final block which will be executed in both the cases of success and failure (try or catch ). you can also refer https://msdn.microsoft.com/en-us/library/87cdya3t%28v=vs.110%29.aspx
to define user defined exception
Thanks
Abhishek
- Edited by Abhishek0127[Abhishek kumar]MVP 3 hours 49 minutes ago
Hi Abhishek
Yes I got what you mean by continuing with the method despite the exception, but then how do I access the exception details in the orchestration, assuming both the webservice calls had a exception
Thanks