4 Replies Latest reply on Jul 22, 2009 4:14 PM by jawed khan

    how to configure the url and port in CXF?

    jawed khan Newbie

      I have to send my request to   http://localhost:8181/cxf/MyServiceSoap

      I want to change port 8181 to 9090 and remove cxf. So my url should be to http://localhost:9090/MyServiceSoap.

      Here is my xbean.xml

          <cxf:cxfEndpoint id="soapMessageEndpoint"

                           serviceClass="com.test.SoapXml2Provider"

                           address="/MyServiceSoap"

                           wsdlURL="MyRequest.wsdl"

                           serviceName="msp:MyRequestService"

                           endpointName="msp:MyRequestPortType"

                           xmlns:msp="http://webservices.test.com/web"/>

       

      Do I configure in cxf.xml?

      Thanks

      Jawed

        • 1. Re: how to configure the url and port in CXF?
          Stan Lewis Novice

          You can either change the soap:address in the WSDL file or you should be able to specify the full address you want for the "address" parameter of the cxfEndpoint element, I'm assuming you're using Camel here from your XML if not can you clarify which FUSE product you're using?

          • 2. Re: how to configure the url and port in CXF?
            Martin Murphy Novice

            I'm a little confused by the fact that you mention the xbean.xml here. Is this a CXF BC deployed in FUSE ESB? If this is the case you could just use a CXF provider and specify the location there:

            <cxfbc:provider wsdl="MyRequest.wsdl" 
                                  locationURI="http://localhost:9090/MyServiceSoap" 
                                  service="msp:MyRequestService" 
                                  endpoint="portname"> 
            </cxfbc:provider> 
            

             

            If you are running using FUSE Services Framework standalone and only want to update the CXF Bus configuration to add the location you just specify whatever address you want on the address attribute of your jaxws:client config.

             

            That said, looking at your config below I assume you want to I'm guess this is a CXF endpoint in a camel route? In that case you can just update the address in your cxf endpoint with the complete address:

                 <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:25100/HelloWorld"
                      serviceClass="com.progress.ts.cameldemo.cxfserver.HelloWorld">
                      <cxf:outInterceptors>
                           <ref bean="logOutbound"></ref>
                      </cxf:outInterceptors>
                      <cxf:properties>
                           <entry key="dataFormat" value="MESSAGE"></entry>
                      </cxf:properties>
                 </cxf:cxfEndpoint>
            

             

            To help illustrate this I threw together a quick example of a message being picked up from a file and sent on to a CXF server via a camel route.

            • 3. Re: how to configure the url and port in CXF?
              jawed khan Newbie

              Hi,

              Thank you for replying. I forgot to mention that I am using FUSE ESB 4.1.0.2. I am using CXF as OSGi not Servicemix-CXF BC.

              Can you provide similar example for CXF OSGi in FUSE ESB 4.x?

              Thanks

              Jawed

              • 4. Re: how to configure the url and port in CXF?
                jawed khan Newbie

                I am trying to change url of the cxf-osgi example. Attached is the cxf-osgi.zip where i changed      

                <jaxws:endpoint id="helloWorld"

                                implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"

                                     address="http://localhost:9090/HelloWorld"/>

                 

                It is not working and throwing following excecption:

                14:51:19,773 | INFO  | xtenderThread-78 | DefaultListableBeanFactory       | pport.DefaultListableBeanFactory  414 | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e136be: defining beans ; root of factory hierarchy

                14:51:19,914 | INFO  | xtenderThread-78 | ReflectionServiceFactoryBean     | .support.JaxWsServiceFactoryBean  163 | Creating Service HelloWorldImplService from class org.apache.servicemix.examples.cxf.HelloWorld

                14:51:19,945 | INFO  | xtenderThread-78 | DefaultListableBeanFactory       | ort.DefaultSingletonBeanRegistry  421 | Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e136be: defining beans ; root of factory hierarchy

                14:51:19,945 | ERROR | xtenderThread-78 | OsgiBundleXmlApplicationContext  | gatedExecutionApplicationContext  366 | Post refresh error

                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloWorld': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalStateException: Endpoint address should be a relative URI wrt to the servlet address (use '/xxx' for example)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

                     at java.security.AccessController.doPrivileged(Native Method)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

                     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

                     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

                     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

                     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

                     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

                     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

                     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)

                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:68)

                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:343)

                     at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:308)

                     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:138)

                     at java.lang.Thread.run(Thread.java:619)

                Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalStateException: Endpoint address should be a relative URI wrt to the servlet address (use '/xxx' for example)

                     at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:275)

                     at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:209)

                     at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:404)

                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                     at java.lang.reflect.Method.invoke(Method.java:597)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)

                     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)

                     ... 17 more

                Caused by: java.lang.IllegalStateException: Endpoint address should be a relative URI wrt to the servlet address (use '/xxx' for example)

                     at org.apache.servicemix.cxf.transport.http_osgi.OsgiTransportFactory.getDestination(OsgiTransportFactory.java:59)

                     at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)

                     at org.apache.cxf.endpoint.ServerImpl.(ServerImpl.java:69)

                     at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:118)

                     at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:167)

                     at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:346)

                     at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:259)

                     ... 26 more