You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by MikeGeorge <mi...@yahoo.com> on 2006/04/15 14:00:41 UTC

How 2 specify EJB service in WSIFBinding

I want to bind an EJB service to ESB, I am having the following binding:
--------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:sm="http://servicemix.org/config/1.0"
      xmlns:lb="http://servicemix.org/demos/loan-broker"
      xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
                          http://servicemix.org/config/1.0
../../conf/servicemix.xsd">
                         
   <sm:container name="jbi"
                 monitorInstallationDirectory="false"
                 createMBeanServer="true"
                 useMBeanServer="true">
      <sm:activationSpecs>

        <sm:activationSpec componentName="wsifEJBBC" service="lb:wsifEJBBC">
         <sm:component>
         <bean xmlns="http://xbean.org/schemas/spring/1.0"
                 class="org.servicemix.components.wsif.WSIFBinding">
           <property name="definitionResource"
value="simplebeanEjbBinding.wsdl"/>
         </bean>  
         </sm:component>
         </sm:activationSpec>
         
        <!-- sm:activationSpec componentName="timer"
destinationService="lb:httpReceiver" -->
        <sm:activationSpec componentName="timer"
destinationService="lb:wsifEJBBC">
          <sm:component>
            <bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.quartz.QuartzComponent">
              <property name="triggers">
                <map>
                  <entry>
                    <key>
                      <bean class="org.quartz.SimpleTrigger">
                        <property name="repeatInterval" value="5000"/>
                        <property name="repeatCount" value="-1"/>
                      </bean>
                    </key>
                      <bean class="org.quartz.JobDetail">
                        <property name="name" value="My Example Job"/>
                        <property name="group" value="ServiceMix"/>
                      </bean>
                  </entry>
                </map>
              </property>
            </bean>
          </sm:component>
        </sm:activationSpec>


      </sm:activationSpecs>
   </sm:container>                

</beans>

My simplebeanEjbBinding.wsdl is shown below:
---------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://wsifservice.addressbook/"

                xmlns="http://schemas.xmlsoap.org/wsdl/"
                xmlns:apachesoap="http://xml.apache.org/xml-soap"
                xmlns:impl="http://wsifservice.addressbook/"
                xmlns:intf="http://wsifservice.addressbook/"
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
                xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/"
               
xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <wsdl:message name="sayHelloResponse">
   </wsdl:message>

   <wsdl:message name="sayHelloRequest">
   </wsdl:message>

   <wsdl:portType name="AddressBookBI">
      <wsdl:operation name="sayHello">
         <wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest"/>
         <wsdl:output message="impl:sayHelloResponse"
name="sayHelloResponse"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="AddressBookBISoapBinding" type="impl:AddressBookBI">
      <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="sayHello">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="sayHelloRequest">
            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://wsifservice.addressbook/" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="sayHelloResponse">
            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://wsifservice.addressbook/" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>

  <wsdl:binding name="EJBBinding" type="impl:AddressBookBI">
    <ejb:binding/>
    <format:typeMapping encoding="Java" style="Java">
      <format:typeMap typeName="xsd:string" formatType="java.lang.String" />
    </format:typeMapping>
    <wsdl:operation name="sayHello">
      <ejb:operation
         methodName="sayHello"
         interface="remote" />
      <wsdl:input name="sayHelloRequest"/>
    </wsdl:operation>
  </wsdl:binding>

   <wsdl:service name="AddressBookBIService">
      <wsdl:port binding="impl:AddressBookBISoapBinding"
name="AddressBookBI">
         <wsdlsoap:address location="http://wsifservice.addressbook/L/"/>
      </wsdl:port>
   </wsdl:service>
   
  <wsdl:service name="AddressBookService">
    <wsdl:port name="EJBPort" binding="impl:EJBBinding">
        <!-- Put vendor-specific deployment information here -->
        <ejb:address className="ejb.service.AddressBookSessionHome"
                     jndiName="ejb20-address-AddressBookSessionHome"
                    
initialContextFactory="weblogic.jndi.WLInitialContextFactory"
                     jndiProviderURL="t3://localhost:7001"/>
    </wsdl:port>
  </wsdl:service>
   
</wsdl:definitions>


I am getting following Exception:
---------------------------------------------

[INFO] DefaultListableBeanFactory - Destroying singletons in factory
{org.springframework.beans.fact
ory.support.DefaultListableBeanFactory defining beans [jbi]; root of
BeanFactory hierarchy}
Caught: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'jbi'
 defined in file [D:\esb\VoidVoidEjb\servicemix.xml]: Initialization of
bean failed; nested exception is javax.jbi.JBIException:
org.apache.wsif.WSIFException: Please speci
fy a Service. Choices are:
{{http://wsifservice.addressbook/}AddressBookService, {http://wsifservice
.addressbook/}AddressBookBIService}
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'jbi' defined
 in file [D:\esb\VoidVoidEjb\servicemix.xml]: Initialization of bean fai
led; nested exception is javax.jbi.JBIException:
org.apache.wsif.WSIFException: Please specify a Ser
vice. Choices are: {{http://wsifservice.addressbook/}AddressBookService,
{http://wsifservice.address
book/}AddressBookBIService}
javax.jbi.JBIException: org.apache.wsif.WSIFException: Please specify a
Service. Choices are: {{http
://wsifservice.addressbook/}AddressBookService,
{http://wsifservice.addressbook/}AddressBookBIServic
e}
        at
org.servicemix.components.wsif.WSIFBinding.init(WSIFBinding.java:88)
        at
org.servicemix.components.util.PojoSupport.init(PojoSupport.java:88)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:887)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:855)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:817)
        at
org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:765)
        at
org.servicemix.jbi.container.SpringJBIContainer.afterPropertiesSet(SpringJBIContainer.jav
a:52)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe
thods(AbstractAutowireCapableBeanFactory.java:1058)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A
bstractAutowireCapableBeanFactory.java:363)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
.java:226)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
.java:147)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle
tons(DefaultListableBeanFactory.java:275)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio
nContext.java:318)
        at
org.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationC
ontext.java:149)
        at
org.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationC
ontext.java:48)
        at org.servicemix.Main.main(Main.java:76)
Caused by: org.apache.wsif.WSIFException: Please specify a Service. Choices
are: {{http://wsifservic
e.addressbook/}AddressBookService,
{http://wsifservice.addressbook/}AddressBookBIService}
        at org.apache.wsif.util.WSIFUtils.getNamedItem(WSIFUtils.java:320)
        at
org.apache.wsif.base.WSIFServiceImpl.init(WSIFServiceImpl.java:836)
        at
org.apache.wsif.base.WSIFServiceImpl.<init>(WSIFServiceImpl.java:299)
        at
org.apache.wsif.base.WSIFServiceImpl.<init>(WSIFServiceImpl.java:262)
        at
org.apache.wsif.base.WSIFServiceImpl.<init>(WSIFServiceImpl.java:251)
        at
org.apache.wsif.base.WSIFServiceFactoryImpl.getService(WSIFServiceFactoryImpl.java:209)
        at
org.servicemix.components.wsif.WSIFBinding.init(WSIFBinding.java:71)
        ... 15 more

Can anyone help me how to specify Service? My method name in EJB is
"sayHello"

Thanks - Mike (mikegeorge12<{at}>yahoo.com)
--
View this message in context: http://www.nabble.com/How-2-specify-EJB-service-in-WSIFBinding-t1454040.html#a3929272
Sent from the ServiceMix - User forum at Nabble.com.


Re: How 2 specify EJB service in WSIFBinding

Posted by Guillaume Nodet <gn...@gmail.com>.
If you have access to your EJB interface, you could try using the
jsr181 component, and using the spring factory beans for accessing
EJB.

  <jsr181:endpoint serviceInterface="com.mycom.MyComponent">
    <jsr181:pojo>
      <bean class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
        <property name="jndiName" value="myComponent"/>
        <property name="businessInterface" value="com.mycom.MyComponent"/>
      </bean>
    </jsr181:pojo>
  </jsr181:endpoint>

I have not tested that yet, but it should work ...

Cheers,
Guillaume Nodet

On 4/15/06, MikeGeorge <mi...@yahoo.com> wrote:
>
> I want to bind an EJB service to ESB, I am having the following binding:
> --------------------------------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://xbean.org/schemas/spring/1.0"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:sm="http://servicemix.org/config/1.0"
>       xmlns:lb="http://servicemix.org/demos/loan-broker"
>       xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
> ../../conf/spring-beans.xsd
>                           http://servicemix.org/config/1.0
> ../../conf/servicemix.xsd">
>
>    <sm:container name="jbi"
>                  monitorInstallationDirectory="false"
>                  createMBeanServer="true"
>                  useMBeanServer="true">
>       <sm:activationSpecs>
>
>         <sm:activationSpec componentName="wsifEJBBC" service="lb:wsifEJBBC">
>          <sm:component>
>          <bean xmlns="http://xbean.org/schemas/spring/1.0"
>                  class="org.servicemix.components.wsif.WSIFBinding">
>            <property name="definitionResource"
> value="simplebeanEjbBinding.wsdl"/>
>          </bean>
>          </sm:component>
>          </sm:activationSpec>
>
>         <!-- sm:activationSpec componentName="timer"
> destinationService="lb:httpReceiver" -->
>         <sm:activationSpec componentName="timer"
> destinationService="lb:wsifEJBBC">
>           <sm:component>
>             <bean xmlns="http://xbean.org/schemas/spring/1.0"
> class="org.servicemix.components.quartz.QuartzComponent">
>               <property name="triggers">
>                 <map>
>                   <entry>
>                     <key>
>                       <bean class="org.quartz.SimpleTrigger">
>                         <property name="repeatInterval" value="5000"/>
>                         <property name="repeatCount" value="-1"/>
>                       </bean>
>                     </key>
>                       <bean class="org.quartz.JobDetail">
>                         <property name="name" value="My Example Job"/>
>                         <property name="group" value="ServiceMix"/>
>                       </bean>
>                   </entry>
>                 </map>
>               </property>
>             </bean>
>           </sm:component>
>         </sm:activationSpec>
>
>
>       </sm:activationSpecs>
>    </sm:container>
>
> </beans>
>
> My simplebeanEjbBinding.wsdl is shown below:
> ---------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://wsifservice.addressbook/"
>
>                 xmlns="http://schemas.xmlsoap.org/wsdl/"
>                 xmlns:apachesoap="http://xml.apache.org/xml-soap"
>                 xmlns:impl="http://wsifservice.addressbook/"
>                 xmlns:intf="http://wsifservice.addressbook/"
>                 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>                 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>                 xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>                 xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/"
>
> xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"
>                 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
>    <wsdl:message name="sayHelloResponse">
>    </wsdl:message>
>
>    <wsdl:message name="sayHelloRequest">
>    </wsdl:message>
>
>    <wsdl:portType name="AddressBookBI">
>       <wsdl:operation name="sayHello">
>          <wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest"/>
>          <wsdl:output message="impl:sayHelloResponse"
> name="sayHelloResponse"/>
>       </wsdl:operation>
>    </wsdl:portType>
>
>    <wsdl:binding name="AddressBookBISoapBinding" type="impl:AddressBookBI">
>       <wsdlsoap:binding style="rpc"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>       <wsdl:operation name="sayHello">
>          <wsdlsoap:operation soapAction=""/>
>          <wsdl:input name="sayHelloRequest">
>             <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> namespace="http://wsifservice.addressbook/" use="encoded"/>
>          </wsdl:input>
>          <wsdl:output name="sayHelloResponse">
>             <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> namespace="http://wsifservice.addressbook/" use="encoded"/>
>          </wsdl:output>
>       </wsdl:operation>
>    </wsdl:binding>
>
>   <wsdl:binding name="EJBBinding" type="impl:AddressBookBI">
>     <ejb:binding/>
>     <format:typeMapping encoding="Java" style="Java">
>       <format:typeMap typeName="xsd:string" formatType="java.lang.String" />
>     </format:typeMapping>
>     <wsdl:operation name="sayHello">
>       <ejb:operation
>          methodName="sayHello"
>          interface="remote" />
>       <wsdl:input name="sayHelloRequest"/>
>     </wsdl:operation>
>   </wsdl:binding>
>
>    <wsdl:service name="AddressBookBIService">
>       <wsdl:port binding="impl:AddressBookBISoapBinding"
> name="AddressBookBI">
>          <wsdlsoap:address location="http://wsifservice.addressbook/L/"/>
>       </wsdl:port>
>    </wsdl:service>
>
>   <wsdl:service name="AddressBookService">
>     <wsdl:port name="EJBPort" binding="impl:EJBBinding">
>         <!-- Put vendor-specific deployment information here -->
>         <ejb:address className="ejb.service.AddressBookSessionHome"
>                      jndiName="ejb20-address-AddressBookSessionHome"
>
> initialContextFactory="weblogic.jndi.WLInitialContextFactory"
>                      jndiProviderURL="t3://localhost:7001"/>
>     </wsdl:port>
>   </wsdl:service>
>
> </wsdl:definitions>
>
>
> I am getting following Exception:
> ---------------------------------------------
>
> [INFO] DefaultListableBeanFactory - Destroying singletons in factory
> {org.springframework.beans.fact
> ory.support.DefaultListableBeanFactory defining beans [jbi]; root of
> BeanFactory hierarchy}
> Caught: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'jbi'
>  defined in file [D:\esb\VoidVoidEjb\servicemix.xml]: Initialization of
> bean failed; nested exception is javax.jbi.JBIException:
> org.apache.wsif.WSIFException: Please speci
> fy a Service. Choices are:
> {{http://wsifservice.addressbook/}AddressBookService, {http://wsifservice
> .addressbook/}AddressBookBIService}
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'jbi' defined
>  in file [D:\esb\VoidVoidEjb\servicemix.xml]: Initialization of bean fai
> led; nested exception is javax.jbi.JBIException:
> org.apache.wsif.WSIFException: Please specify a Ser
> vice. Choices are: {{http://wsifservice.addressbook/}AddressBookService,
> {http://wsifservice.address
> book/}AddressBookBIService}
> javax.jbi.JBIException: org.apache.wsif.WSIFException: Please specify a
> Service. Choices are: {{http
> ://wsifservice.addressbook/}AddressBookService,
> {http://wsifservice.addressbook/}AddressBookBIServic
> e}
>         at
> org.servicemix.components.wsif.WSIFBinding.init(WSIFBinding.java:88)
>         at
> org.servicemix.components.util.PojoSupport.init(PojoSupport.java:88)
>         at
> org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:887)
>         at
> org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:855)
>         at
> org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:817)
>         at
> org.servicemix.jbi.container.JBIContainer.activateComponent(JBIContainer.java:765)
>         at
> org.servicemix.jbi.container.SpringJBIContainer.afterPropertiesSet(SpringJBIContainer.jav
> a:52)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe
> thods(AbstractAutowireCapableBeanFactory.java:1058)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A
> bstractAutowireCapableBeanFactory.java:363)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
> .java:226)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
> .java:147)
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle
> tons(DefaultListableBeanFactory.java:275)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio
> nContext.java:318)
>         at
> org.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationC
> ontext.java:149)
>         at
> org.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationC
> ontext.java:48)
>         at org.servicemix.Main.main(Main.java:76)
> Caused by: org.apache.wsif.WSIFException: Please specify a Service. Choices
> are: {{http://wsifservic
> e.addressbook/}AddressBookService,
> {http://wsifservice.addressbook/}AddressBookBIService}
>         at org.apache.wsif.util.WSIFUtils.getNamedItem(WSIFUtils.java:320)
>         at
> org.apache.wsif.base.WSIFServiceImpl.init(WSIFServiceImpl.java:836)
>         at
> org.apache.wsif.base.WSIFServiceImpl.<init>(WSIFServiceImpl.java:299)
>         at
> org.apache.wsif.base.WSIFServiceImpl.<init>(WSIFServiceImpl.java:262)
>         at
> org.apache.wsif.base.WSIFServiceImpl.<init>(WSIFServiceImpl.java:251)
>         at
> org.apache.wsif.base.WSIFServiceFactoryImpl.getService(WSIFServiceFactoryImpl.java:209)
>         at
> org.servicemix.components.wsif.WSIFBinding.init(WSIFBinding.java:71)
>         ... 15 more
>
> Can anyone help me how to specify Service? My method name in EJB is
> "sayHello"
>
> Thanks - Mike (mikegeorge12<{at}>yahoo.com)
> --
> View this message in context: http://www.nabble.com/How-2-specify-EJB-service-in-WSIFBinding-t1454040.html#a3929272
> Sent from the ServiceMix - User forum at Nabble.com.
>
>