You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by nareshkpotti <po...@gmail.com> on 2012/08/15 00:58:47 UTC

Install WS as bundles and opening/accessing WSDL in browser

Hi,

I have successfully implemented Web Service proxy using Service mix 4.4.1,
camel 2.8.4 and cxf 2.4.6.
Problem is i am not able to access WSDL in the browser if i specify address
as /XYZWSV1Port instead of specifying
http://localhost:8185/camel-example-cxf-proxy/webservices/XYZWSV1Port.

I am trying to install Web Service as a stand alone bundle in service mix
and able to create proxy for actual service.

My camel-config.xml looks like
<import resource="classpath:META-INF/cxf/cxf.xml"/>

<bean id="proxyInProcessor" class="com.abc.cxf.proxy.ProxyInProcessor"/>
	
	<bean id="proxyOutProcessor" class="com.abc.cxf.proxy.ProxyOutProcessor"/>

<cxf:cxfEndpoint  id="XYZWSV1" 
                   <b>address="/XYZWSV1Port"*
                   endpointName="s:XYZWSV1Port"
                   serviceName="s:XYZWSV1Service"
                   wsdlURL="etc/xyzwsV1.wsdl" 
                   xmlns:s="http://www.abc.com/XYZWS"/>   

When i try to deploy bundle, i could see following in the logs.

 17:26:23,786 | INFO  | ExtenderThread-6 | ReflectionServiceFactoryBean    
| 141 - org.apache.cxf.bundle - 2.4.6 | Creating Service
{http://www.abc.com/XYZWS}XYZWSV1Service from WSDL: etc/xyzwsV1.wsdl
17:26:23,817 | INFO  | ExtenderThread-6 | ServerImpl                       |
141 - org.apache.cxf.bundle - 2.4.6 | Setting the server's publish address
to be /XYZWSV1Port

My bundle is built with groupid- cws and artifactid-abcAPI.

What url can i use to access WSDL from browser???

I am getting following error with this wsdl url -
http://localhost:8181/abcAPI/XYZWSV1Port?WSDL

HTTP ERROR: 404

Problem accessing /abcAPI/CustomerWSV1Port. Reason:

    Not Found

Powered by Jetty://

Thanks,
Potti




--
View this message in context: http://servicemix.396122.n5.nabble.com/Install-WS-as-bundles-and-opening-accessing-WSDL-in-browser-tp5714152.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Install WS as bundles and opening/accessing WSDL in browser

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

I don't think you can use relative path 
<to uri="/xyzV1Port"/> 
instead of 
<to uri="http://localhost:8181/aaa/bbb/xyzV1Port"/>
in camel context.

The relative path like /xyzV1Port only works in cxf endpoint configuration and indicate this cxf endpoint should use http-osgi transport. You still need use full path when you refer it in your camel context.

And use nmr endpoint doesn't help in this case, as with nmr endpoint you external client can't access it directly.

Freeman




-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-22, at 上午7:17, nareshkpotti wrote:

> Hi Freeman,
>   Thank you for the reply. This works like a charm. I have another thing
> which i am stuck with.
> From my proxy bundle i am exposing proxy services using cxf endpoint and
> producer is a JAXWS endpoint which is present in another bundle. 
> <cxf:cxfEndpoint id="xyzWSV2"
>>                  address="/xyzWSV2Port"
>>                  endpointName="s:xyzWSV2Port"
>>                  serviceName="s:xyzWSV2Service"
>>                  wsdlURL="etc/xyzV2.wsdl"
>>                  xmlns:s="http://www.ccc.com/xyzWS"/> 
> 
> <camelContext xmlns="http://camel.apache.org/schema/spring" >
>    <route>
>      <from uri="cxf:bean:customerWSV2?dataFormat=MESSAGE" />
>        <setExchangePattern pattern="InOut"/>
>      <process ref="proxyInProcessor" /> 
>       *<to uri="http://localhost:8181/aaa/bbb/xyzV1Port"/> *
> 
>      <to uri="proxyOutProcessor" />
>    </route>
>  </camelContext> 
> 
> How can i refer in camel route to use real web service as *<to
> uri="/xyzV1Port"/>* instead of *<to
> uri="http://localhost:8181/aaa/bbb/xyzV1Port"/>.*
> 
> Both for proxy and actual web services will have same context.
> 
> Does using nmr a good option??? If so how can i use with JAXWS endpoint with
> nmr and refer to camel context?? and our real web service already have some
> clients who should not be disturbed
> 
> Thanks,
> Potti
> 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Install-WS-as-bundles-and-opening-accessing-WSDL-in-browser-tp5714152p5714211.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Install WS as bundles and opening/accessing WSDL in browser

Posted by nareshkpotti <po...@gmail.com>.
Hi Freeman,
   Thank you for the reply. This works like a charm. I have another thing
which i am stuck with.
>From my proxy bundle i am exposing proxy services using cxf endpoint and
producer is a JAXWS endpoint which is present in another bundle. 
<cxf:cxfEndpoint id="xyzWSV2"
>                   address="/xyzWSV2Port"
>                   endpointName="s:xyzWSV2Port"
>                   serviceName="s:xyzWSV2Service"
>                   wsdlURL="etc/xyzV2.wsdl"
>                   xmlns:s="http://www.ccc.com/xyzWS"/> 

<camelContext xmlns="http://camel.apache.org/schema/spring" >
    <route>
      <from uri="cxf:bean:customerWSV2?dataFormat=MESSAGE" />
        <setExchangePattern pattern="InOut"/>
      <process ref="proxyInProcessor" /> 
       *<to uri="http://localhost:8181/aaa/bbb/xyzV1Port"/> *
      
      <to uri="proxyOutProcessor" />
    </route>
  </camelContext> 

How can i refer in camel route to use real web service as *<to
uri="/xyzV1Port"/>* instead of *<to
uri="http://localhost:8181/aaa/bbb/xyzV1Port"/>.*

Both for proxy and actual web services will have same context.

Does using nmr a good option??? If so how can i use with JAXWS endpoint with
nmr and refer to camel context?? and our real web service already have some
clients who should not be disturbed

Thanks,
Potti




--
View this message in context: http://servicemix.396122.n5.nabble.com/Install-WS-as-bundles-and-opening-accessing-WSDL-in-browser-tp5714152p5714211.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Install WS as bundles and opening/accessing WSDL in browser

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

As I mentioned, the default service address is
http://localhost:8181/cxf${the_address_you_specified}

However, you can change the /cxf to whatever you want, just drop a org.apache.cxf.osgi.cfg in $SMX_HOME/etc/ folder, specify a property like
org.apache.cxf.servlet.context=/mycontext
then the service address changed to
http://localhost:8181/mycontext${the_address_you_specified}

This way leverage OSGi configAdmin service to configure properties.
Freeman

-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-18, at 上午12:19, nareshkpotti wrote:

> Hi Freeman,
> 
> Thanks for the reply. I figured it out by debugging using the source code of
> service mix. 
> 
> But I implemented it in different manner as we are not supposed to change
> the url for WS as many of our 3rd party clients and internal clients will
> get effected.
> 
> <bean id="propertyPlaceholderConfigurer"
> 
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>        <property name="locations">
>                <list>
>                     <value>file:${bbb.bbb.bbb}/ccc.properties
>                     </value>
>                </list>
>        </property>
>    </bean>
> 
> from "bbb.bbb.bbb", we will get the location where properties file will be
> located. At this place our sys admins place all the properties file which
> will be shared by all the server instances.
> 
> <cxf:cxfEndpoint id="xyzWSV1" 
>                   address="${proxy.url}/abcAPI/ccc/xyzWSV1Port"
>                   endpointName="s:xyzWSV1Port"
>                   serviceName="s:xyzWSV1Service"
>                   wsdlURL="etc/xyzV1.wsdl" 
>                   xmlns:s="http://www.ccc.com/xyzWS"/> .
> 
> proxy.url will be the domain name or server name with port number. By this
> as our code moves from different stages like dev to QA and from QA to prod,
> proxy.url part will be changed accordingly.
> 
> Thanks,
> Potti
> 
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Install-WS-as-bundles-and-opening-accessing-WSDL-in-browser-tp5714152p5714167.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Install WS as bundles and opening/accessing WSDL in browser

Posted by nareshkpotti <po...@gmail.com>.
Hi Freeman,
              
Thanks for the reply. I figured it out by debugging using the source code of
service mix. 

But I implemented it in different manner as we are not supposed to change
the url for WS as many of our 3rd party clients and internal clients will
get effected.

 <bean id="propertyPlaceholderConfigurer"
       
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
                <list>
                     <value>file:${bbb.bbb.bbb}/ccc.properties
                     </value>
                </list>
        </property>
    </bean>

from "bbb.bbb.bbb", we will get the location where properties file will be
located. At this place our sys admins place all the properties file which
will be shared by all the server instances.

<cxf:cxfEndpoint id="xyzWSV1" 
                   address="${proxy.url}/abcAPI/ccc/xyzWSV1Port"
                   endpointName="s:xyzWSV1Port"
                   serviceName="s:xyzWSV1Service"
                   wsdlURL="etc/xyzV1.wsdl" 
                   xmlns:s="http://www.ccc.com/xyzWS"/> .

proxy.url will be the domain name or server name with port number. By this
as our code moves from different stages like dev to QA and from QA to prod,
proxy.url part will be changed accordingly.

Thanks,
Potti




--
View this message in context: http://servicemix.396122.n5.nabble.com/Install-WS-as-bundles-and-opening-accessing-WSDL-in-browser-tp5714152p5714167.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Install WS as bundles and opening/accessing WSDL in browser

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

If you use address like /XYZWSV1Port,  you use cxf http-osgi transport,
which underlying is OSGi http service(implemented by pax-web), in this case,
per your configuration, the default address should be

http://localhost:8181/cxf/XYZWSV1Port?WSDL

Freeman



--
View this message in context: http://servicemix.396122.n5.nabble.com/Install-WS-as-bundles-and-opening-accessing-WSDL-in-browser-tp5714152p5714159.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.