Unable to find assembly for contract 'Erp.Contracts.SalesOrderSvcContract'

Hi All,

I wonder if anyone could advise on the problem I am currently having.
I am trying to setup a MSTest which mimicks an Epicor call for MasterUpdate on SalesOrder.

When I run my test, I get the error message in the title of this topic.
My code is below:

using (var session = new Ice.Core.Session(
                "<username>",
                "<password>",
                null,
                Ice.Core.Session.LicenseType.Default,
                @"C:\Epicor\ERP10.1.400.29Client\Client\Config\EpicorERPUAT2.sysconfig", false, "MESMUK"))
            {
                //Set up Tableset
                SalesOrderSvcContract svcSalesOrder;
                **** Problem Line *****
                svcSalesOrder = Ice.Assemblies.ServiceRenderer.GetService<SalesOrderSvcContract>(Db);
                *************************
                Erp.Tablesets.SalesOrderTableset so = new Erp.Tablesets.SalesOrderTableset();


                //so = svcSalesOrder.GetByID(OrderNum);

                //Set Up function variables
                bool lCheckForOrderChangedMsg = true;
                bool lcheckForResponse = true;
                string cTableName = "OrderRel";
                int iCustNum = so.OrderHed[0].CustNum;
                int iOrderNum = so.OrderHed[0].OrderNum;
                bool lweLicensed = true;
                bool lContinue = false;
                string cResponseMsg = "";
                string cCreditShipAction = "";
                string cDisplayMsg = "";
                string cCompliantMsg = "";
                string cResponseMsgOrdRel = "";


                result = jo.ProcessJobActions(ref lCheckForOrderChangedMsg, ref lcheckForResponse, ref cTableName, ref iCustNum, ref iOrderNum, ref lweLicensed,
                                              ref lContinue, ref cResponseMsg, ref cCreditShipAction, ref cDisplayMsg, ref cCompliantMsg, ref cResponseMsgOrdRel, so);
            }

I have checked all my references and I beleive to have them all.

Any ideas on what I can further check, or if anyone else has come across this problem and found the root?

Kind Regards,
Dan

I use this pattern quite regularly, and the only differences I can see to my usual code (assuming all the references are in place, which you say is the case) is that I use “var”, specify the exact dll, and I haven’t needed “Db” where I use it:

var svc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>();

These things do behave slightly differently in different places, but in BPMs and uBAQs the above works fine.

Thanks for the reply Daryl.

I tried making the changes you suggested but it didn’t change anything.

Maybe I am wrong about my references, below is what I have:
image

Can you see anything missing?

I don’t think there would be anything missing from that list if you were working within Epicor. Trying to create Epicor code anywhere else, I’m not really qualified to judge, I’m afraid.

I would perhaps try adding the relevant adapter as well as the contract, but based on nothing but guessing. You probably need someone with the SDK to chip in, because they have the keys to things that the rest of us have to work out by trial and error.

No problem Daryl, thanks for the input.
It gave me a couple of new angles to try.

I’m still on 10.1.4, so this method may have changed, but this is what I use outside Epicor:
var svc = WCFServiceSupport.CreateImpl<Erp.Proxy.BO.SalesOrderImpl>(session, Epicor.ServiceModel.Channels.ImplBase<Erp.Contracts.SalesOrderSvcContract>.UriPath);
I just confirmed I get the same error you do when I try your method, but my (admittedly more verbose) one works.

1 Like

Yeh, we are still on 10.1.4.

I had looked at that way of doing it, however i need a TableSet not a Dataset. Maybe I missing something, do you know if I can convert a Dataset to a Tableset without having to process each feild manually?

I went digging through some of my old code, because I remembered dealing with tablesets at least once…it looks like I tried to copy code from a BPM that included using “Db” as a parameter. I also tried passing “new Ice.IceDataContext()” which gave me a type initialization error. I found another way to test what I needed then, but that might be the key–figuring out how to pass a valid IceDataContext when you don’t have access to a BPM’s Db.