How to apply Remoting

Posts   
 
    
jason...
User
Posts: 14
Joined: 03-Sep-2007
# Posted on: 03-Sep-2007 13:21:58   

I've tried to build a single test project contained all data access, business logic, and UI code. It seems pretty good.

I've also tried UI code consuming Web Service, lt's workable.

But, I failed when I try to use remoting.

Can anyone tell me what should I do at Data and UI tier?

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 04-Sep-2007 11:32:00   

Please specify more information about your setup and what exactly have you tried, and what was the outcome?

jason...
User
Posts: 14
Joined: 03-Sep-2007
# Posted on: 05-Sep-2007 08:49:43   

The remote server site class "Test" is


    public class Test: MarshalByRefObject
    {
        public [colorvalue="FF0000"]EmployeeEntity [/color]GetEmployee(int employeeId)
        {
            EmployeeEntity emp = new EmployeeEntity(17);
            DataAccessAdapter daa = new DataAccessAdapter();
            daa.FetchEntity(emp);
            return emp;
        }
    }

I got an error (null exception) when I was going to create proxy class by soapsuds utitily.

soapsuds -ia:Test -nowp -oa:P roxy.dll

But, if return type of GetEmployee method is object. I can use soapsude to create proxy class successfully.


        public [colorvalue="FF0000"]object [/color]GetEmployee(int employeeId)
        {
            EmployeeEntity emp = new EmployeeEntity(17);
            DataAccessAdapter daa = new DataAccessAdapter();
            daa.FetchEntity(emp);
            return emp;
        }

I just have no idea about it.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 06-Sep-2007 11:49:26   

I think we need more info how you setup the remoting: i.e. what is the setup you specified in the config file, how are you obtaining the service object etc. etc.

Frans Bouma | Lead developer LLBLGen Pro
jason...
User
Posts: 14
Joined: 03-Sep-2007
# Posted on: 10-Sep-2007 10:05:27   

These steps below were what I have done.

1) I created a LLBLGen Pro project and done some trial design work it uses MSSQL 2005 AdventureWorks DB. The version of LLBLGen Pro was 2.5.

2) Generated the source code by C#, .Net2.0, template Adapter, preset General settings.

3) Used the source code produced from the previous step to write a test class, like this:


    public class Test: MarshalByRefObject
    {
        public EmployeeEntity GetEmployee(int employeeId)
        {
            EmployeeEntity emp = new EmployeeEntity(employeeId);
            DataAccessAdapter daa = new DataAccessAdapter();
            daa.FetchEntity(emp);
            return emp;
        }
    }

4) Built the source code above. Everything seems OK until now. The assembly AdvWorks1Data.dll had been made successfully.

5) At last, I wanted to create remoting proxy class of AdvWorks1Data.dll by soapsuds, but I got an error (about null exception). The command I used was

soapsuds -ia:AdvWorks1Data -gc

I think that's a very simple test, but I just can't do it right. Have I done anything wrong?

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 11-Sep-2007 09:15:57   

Hi,

I do not use soapsuds with remoting, I prefer to use an Interface assembly. Do you have a copy of the assembly, where EmployeeEntity is defined, in the same directory where AdvWorks1Data.dll is at the time that you run soapsuds?

Do you have other types that do not inherit from MarshalByRefObject in the assembly AdvWorks1Data.dll?

jason...
User
Posts: 14
Joined: 03-Sep-2007
# Posted on: 12-Sep-2007 12:53:14   

OK, I will use an interface assembly instead.

Thanks.