users@glassfish.java.net

Re: Multiple EJBs into one web service

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Mon, 23 Apr 2007 08:26:16 -0700

Vijay Ramachandran wrote:
> I am CCing the jaxws alias to get their input on this.
>
> glassfish_at_javadesktop.org wrote:
>> Hi folks.
>>
>> I am working on a demo, which has 2 stateless session beans.
>> BankTeller and InsuranceBroker.
>>
>> These are marked with @WebService, which I can compile and deploy on
>> Glassfish. All is well.
>>
>>
>> Now I would like to package the 2 beans as one service (one WSDL). I
>> have tried messing with all the parameters of the @WebService
>> annotation, to no avail.
At present, there is no way to create one WSDL for two services. It is
difficult to resolve conflicts while putting two services as part of
one wsdl.
>>
>> The reason I want todo this, is that the 2 session beans have
>> functions named the same, which seems to break wsimport.
>>
>> example code.
>>
>> [code]
>> @Stateless
>> @WebService(
>> name="BankTeller",
>> portName="BankTellerPort",
>> serviceName="FinancialService",
>> targetNamespace="com.starjar.test.testwebservice")
>> public class BankTellerBean implements BankTellerLocal {
>>
>> public List<BankAccount> find(String name) {
>> return null;
>> }
>> }
>>
>>
>>
>> @Stateless
>> @WebService(
>> name="InsuranceBroker",
>> portName="InsuranceBrokerPort",
>> serviceName="FinancialService",
>> targetNamespace="com.starjar.test.testwebservice")
>> public class InsuranceBrokerBean implements
>> testwebservice.InsuranceBrokerLocal {
>> public List<InsurancePolicy> find(String name) {
>> return null;
>> }
>> }
>>
>>
>>
>> [/code]
>>
>>
>> When wsimport is run against the Insurance broker wsdl a class called
>> FindResponse is created.
>> When I run wsimport again, FindResponse is over written.
Client-side options:
Can you not run the second wsimport with a different package ?
Otherwise, you need to create a customization file and feed it to
wsimport to avoid the conflict.
Server-side options:
One more option is to create a response wrapper annotation on the
InsuranceBrokerBean:find method. Then wsimport should go through fine.
The following thread would help you

http://forums.java.net/jive/thread.jspa?messageID=202764&#202764

Jitu