Biztalk custom sendpipe line error-[System.Data.MetadataException] = {"Unable to load the specified metadata resource."}


hi friends,

i developing custom send pipeline.i using entity framework model develop pipeline.

the method,it take xml file input , dynamically xpath values in sql table if thing match in xml document replace values sql values.

method looks that

            

public xmldocument updatemfiles(xmldocument inmsgxml)
        {
            //xmldocument doc = new xmldocument();
            //doc.load(ms);
            iconfighelper confighelper = new confighelper();
            //dataentities db = new dataentities(confighelper.getgeneralconfigvalue(connectionstring));

            econnection = new entityconnection(confighelper.getgeneralconfigvalue(connectionstring));
            db = new dataentities(econnection);

            iqueryable<mdata> custquery = db.mdata.asqueryable<mdata>();
            if (custquery != null)
            {
                list<mdata> mlist= custquery.tolist();

                if (mlist!= null && mlist.count > 0)
                {
                    foreach (mdata mdata in mlist)
                    {
                        string xpath = mdata.xpath;
                        //iterate nodes
                        xmlnodelist xnl = inmsgxml.selectnodes(xpath);
                        foreach (xmlnode node in xnl)
                        {
                            if (node != null)
                            {
                                node.innertext = mdata.replacevalue;
                            }
                        }

                    }
                }
            }

            return inmsgxml;
        }

i develop custom pipeline component that,

public ibasemessage execute(ipipelinecontext pc, ibasemessage inmsg)
        {
           
            {
               
              
                // check arguments
                #region argument check
                if (null == pc)
                    throw new argumentnullexception("pc");
                if (null == inmsg)
                    throw new argumentnullexception("inmsg");
                if (null == inmsg.bodypart)
                    throw new argumentnullexception("inmsg.bodypart");
                if (null == inmsg.bodypart.getoriginaldatastream())
                    throw new argumentnullexception("inmsg.getoriginaldatastream");
                
                #endregion argument check

                #region isdisabled
                //this method gets executed when enabled property set in pipeline designer
                if (!isenabled)
                {
                    return inmsg;
                }
                #endregion


                ibasemessagepart bodypart = inmsg.bodypart;
                bodypart = inmsg.bodypart;
                
                //string destpartyname = "";
                //string destmesstype  = "";

                if (bodypart != null)
                {
                    
                    
                    xmldocument xdoc = getorginalstreamtoxml(inmsg);

                    updatemfiles md = new updatemfiles();
                    md.updatemfiless(xdoc);
                    
                    byte[] bufferoutgoingmessage = system.text.asciiencoding.ascii.getbytes(xdoc.outerxml.tostring());
                    system.io.memorystream ms = new system.io.memorystream(bufferoutgoingmessage);
                    inmsg.bodypart.data = ms;
                    pc.resourcetracker.addresource(ms);
                    return inmsg;

                                   
                    
                }
            }
            catch (exception ex)
            {
                throw ex;
            }
            finally
            {
                //if (parms != null)
                //    parms.clear();
            }

            return inmsg;
        }
         
         private static xmldocument getorginalstreamtoxml(ibasemessage inmsg)
         {
             //to incoming message
             system.io.stream originalstream = inmsg.bodypart.getoriginaldatastream();
             //working xdocument
             xmldocument xdoc;
             xdoc = new xmldocument();
 
             using (xmlreader reader = xmlreader.create(originalstream))
             {
                 reader.movetocontent();
                 xdoc.load(reader);
             }

             return xdoc;
         }

        #endregion


    }
}

when run file giving strange error unable load specific metadata resources.

can 1 check method , pipeline component correct.

thanks

hk


hk

code looks fine. should find detailed error in event viewer. please share one!

if answers question please mark answer. if post helpful, please vote helpful.



BizTalk Server  >  BizTalk Server EDI and AS2



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'