You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "Meda, Narasimha" <na...@bankofamerica.com> on 2008/08/04 16:14:49 UTC

Web service URL problem with ServiceMix-CXF

Hi,

 

  I am using the ServiceMix-3.2.1 version, defined the cxf binding and
se components using the lightweight mode.  as below in the
servicemix.xml.

 

I am using the Tomcat5.5 server. Servicemix-3.2.1 is deployed on tomcat
as a webapp.

 

            <sm:activationSpec>

                        <sm:component>

                          <cxfbc:component>  

                                                <cxfbc:endpoints>

                                                <cxfbc:consumer
wsdl="/WEB-INF/wsdl/AR_CR.wsdl"

                                                service="AR:Search"

 
interfaceName="AR:SearchCR"

 
targetEndpoint="SearchCR"

 
targetService="AR:Search"

 
targetInterface="AR:SearchCR" />

                                                </cxfbc:endpoints>

                           </cxfbc:component>               

                         </sm:component>

    </sm:activationSpec>

    

    <sm:activationSpec>

             <sm:component>

                  <cxfse:component>

                        <cxfse:endpoints> 

                              <cxfse:endpoint>

                                    <cxfse:pojo>

                                          <bean
class="com.search.SearchCRImpl"/>

                                    </cxfse:pojo>

                              </cxfse:endpoint>

                        </cxfse:endpoints>

                  </cxfse:component>

            </sm:component>

      </sm:activationSpec>

 

 

When I started the server I am getting the below exception. Tomcat is
running on 8020. It looks jetty is trying to use the same port.  Because
in the WSDL , at the port definition, same port was specified.

 

INFO  - ComponentMBeanImpl             - Initializing component:
servicemix-cxf-bc

Aug 3, 2008 7:17:41 PM sun.reflect.NativeMethodAccessorImpl invoke0

INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via
org.mortbay.log.Slf4jLog

Aug 3, 2008 7:17:41 PM sun.reflect.NativeMethodAccessorImpl invoke0

INFO: jetty-6.1.5

Aug 3, 2008 7:17:41 PM sun.reflect.NativeMethodAccessorImpl invoke0

WARNING: failed SelectChannelConnector@0.0.0.0:8020

java.net.BindException: Address already in use

            at sun.nio.ch.Net.bind(Native Method)

            at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119
)

            at
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)

            at
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector
.java:211)

            at
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnec
tor.java:309)

            at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)

            at org.mortbay.jetty.Server.doStart(Server.java:228)

            at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)

            at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(Jet
tyHTTPServerEngine.java:244)

            at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyH
TTPDestination.java:143)

            at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractO
bservable.java:47)

            at
org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:119)

 

 

Note: But when I used the CXF2.1 framework without servicemix, I do not
have this problem. I got the following features from CXF2.1

   1) CXF does not depend on the URL  specified in the WSDL at port
element as Soap address.

      Normally it is a dummy address

 

   2) CXF  runs the web service on the same port that tomcat is running
. I just need to specify jaxws:endpoint with address.

 

 

How do I acheive the above two in the lightweight mode in servicemix.

 

 

Any help in this issue is appreciated.

 

 

Thanks

MNBabu


Re: Web service URL problem with ServiceMix-CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You want to use tomcat to expose your webservice of cxf bc consumer, 
reuse the port same as tomcat, right?
If in this case, it means you need use servlet transport which use 
tomcat underlying but not http transport.
To do it, when you deploy smx into servlet container such as tomcat.
You need add
<servlet>
       <servlet-name>cxf</servlet-name>
       <display-name>cxf</display-name>
       <description>Apache CXF Endpoint</description>
       
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
       <servlet-name>cxf</servlet-name>
       <url-pattern>/services/*</url-pattern>
   </servlet-mapping>
to the /webapps/apache-servicemix-web-3.2.2/WEB-INF/web.xml
this servlet just replace http transport with servlet transport, so that 
you can avoid starting jetty server when start cxf bc consumer, just 
reuse the http server provided by your servlet container,
Also, you need add
locationURI="/whateveryouwant"
for your cxf bc consumer configuration
then you can access the wsdl by
http://localhost:8080/apache-servicemix-web-3.2.2/services/whateveryouwant?wsdl 


Btw, there is an issue [1] to prevent the transport replacement in smx, 
I fix it in servicemix3.2.2 release, so you need use the recent released 
smx 3.2.2

[1]https://issues.apache.org/activemq/browse/SM-1301

Regards
Freeman


Meda, Narasimha wrote:
> Hi,
>
>  
>
>   I am using the ServiceMix-3.2.1 version, defined the cxf binding and
> se components using the lightweight mode.  as below in the
> servicemix.xml.
>
>  
>
> I am using the Tomcat5.5 server. Servicemix-3.2.1 is deployed on tomcat
> as a webapp.
>
>  
>
>             <sm:activationSpec>
>
>                         <sm:component>
>
>                           <cxfbc:component>  
>
>                                                 <cxfbc:endpoints>
>
>                                                 <cxfbc:consumer
> wsdl="/WEB-INF/wsdl/AR_CR.wsdl"
>
>                                                 service="AR:Search"
>
>  
> interfaceName="AR:SearchCR"
>
>  
> targetEndpoint="SearchCR"
>
>  
> targetService="AR:Search"
>
>  
> targetInterface="AR:SearchCR" />
>
>                                                 </cxfbc:endpoints>
>
>                            </cxfbc:component>               
>
>                          </sm:component>
>
>     </sm:activationSpec>
>
>     
>
>     <sm:activationSpec>
>
>              <sm:component>
>
>                   <cxfse:component>
>
>                         <cxfse:endpoints> 
>
>                               <cxfse:endpoint>
>
>                                     <cxfse:pojo>
>
>                                           <bean
> class="com.search.SearchCRImpl"/>
>
>                                     </cxfse:pojo>
>
>                               </cxfse:endpoint>
>
>                         </cxfse:endpoints>
>
>                   </cxfse:component>
>
>             </sm:component>
>
>       </sm:activationSpec>
>
>  
>
>  
>
> When I started the server I am getting the below exception. Tomcat is
> running on 8020. It looks jetty is trying to use the same port.  Because
> in the WSDL , at the port definition, same port was specified.
>
>  
>
> INFO  - ComponentMBeanImpl             - Initializing component:
> servicemix-cxf-bc
>
> Aug 3, 2008 7:17:41 PM sun.reflect.NativeMethodAccessorImpl invoke0
>
> INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via
> org.mortbay.log.Slf4jLog
>
> Aug 3, 2008 7:17:41 PM sun.reflect.NativeMethodAccessorImpl invoke0
>
> INFO: jetty-6.1.5
>
> Aug 3, 2008 7:17:41 PM sun.reflect.NativeMethodAccessorImpl invoke0
>
> WARNING: failed SelectChannelConnector@0.0.0.0:8020
>
> java.net.BindException: Address already in use
>
>             at sun.nio.ch.Net.bind(Native Method)
>
>             at
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119
> )
>
>             at
> sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
>
>             at
> org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector
> .java:211)
>
>             at
> org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnec
> tor.java:309)
>
>             at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>
>             at org.mortbay.jetty.Server.doStart(Server.java:228)
>
>             at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>
>             at
> org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(Jet
> tyHTTPServerEngine.java:244)
>
>             at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyH
> TTPDestination.java:143)
>
>             at
> org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractO
> bservable.java:47)
>
>             at
> org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:119)
>
>  
>
>  
>
> Note: But when I used the CXF2.1 framework without servicemix, I do not
> have this problem. I got the following features from CXF2.1
>
>    1) CXF does not depend on the URL  specified in the WSDL at port
> element as Soap address.
>
>       Normally it is a dummy address
>
>  
>
>    2) CXF  runs the web service on the same port that tomcat is running
> . I just need to specify jaxws:endpoint with address.
>
>  
>
>  
>
> How do I acheive the above two in the lightweight mode in servicemix.
>
>  
>
>  
>
> Any help in this issue is appreciated.
>
>  
>
>  
>
> Thanks
>
> MNBabu
>
>
>