Java Consumers of WebServices Exposing LLBLGen Entities

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 18-Sep-2006 21:57:46   

If I expose some web methods what return entity and entity collection objects, does any one have any idea what would happen if the consumer of my service methods is JAVA?

Apparently, there are tools in JAVA to have java classes created from a wsdl definition (just like how we use VS.NET to generate a C# or VB.NET proxy).

Has anyone tried this yet with LLBLGen2 and JAVA?

Just curious.

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 18-Sep-2006 23:09:31   

I dont think its going to work, becuase the WSDL def isn't really a good definition if its from the webservice addon..

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 19-Sep-2006 09:13:58   

When doing webservices you should really expose only primitive types such as string, int. etc. and not classes because this is the real interoperability webservices are designed for....

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39797
Joined: 17-Aug-2003
# Posted on: 19-Sep-2006 11:09:45   

mihies wrote:

When doing webservices you should really expose only primitive types such as string, int. etc. and not classes becuaes this is the the real interoperability webservices are designed for....

I second that. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 19-Sep-2006 19:35:22   

So, are you proposing an RPC style of web service or a Document / Message based style of web service? Both can be achieved with primitive types.

Arent classes that only use primitives just as interoperable as RPC style methods, except for the fact that the message contract is made clearer because of the message definition?

My personal style is to write methods like this:


    [WebMethod]
    public CustomerResponse FindCustomers(CustomerRequest request)
    {
        CustomerResponse myResponse = new CustomerResponse();
        List<CustomerDto> myCustomers = new List<CustomerDto>();
        CustomerCollection myCollection = MyBusinessObject.FetchCollection(request.FirstName, 
            request.LastName);
        foreach(CustomerEntity entity in myCollection)
        {
            CustomerDto customerDto = new CustomerDto();
            DataMapper.MapData(entity, customerDto);
            myCustomers.Add(customerDto);
        }

        myResponse.Customers = myCustomers.ToArray();
        return myResponse;
    }

An alternative style would be use RPC


    [WebMethod]
    public string FindCustomers(string firstName, string lastName)
    {
        return MyBusinessObject.FetchCollection(firstName, lastName).ToXml();
    }

Is my coding style along the lines of the more "preferred" approach to service implementation?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39797
Joined: 17-Aug-2003
# Posted on: 20-Sep-2006 10:53:43   

I don't think it would matter much. The thing is that whatever you're using, it's pre-defined and locked, so if you're using the message based approach, the message structure is locked, and if you're using methods, it's also a locked interface. The advantage of using messages is that you can pass it on to multiple services, adding data on the route followed.

Frans Bouma | Lead developer LLBLGen Pro