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/05/15 21:45:13 UTC

Creating Webservice in servicemix with cxf and install as a osgi bundle

I am trying to create a web service using service mix 4.3, apache cxf 2.3 and
spring 3.0.5.I am following WSDL first method for this I created a WSDL and
generated code from it and I am writing web service implementation in
generated implementation class and defining endpoint in context file as 

    <jaxws:endpoint id="XYZCustomerMgmtWS" 
    address="/XYZCustomerMgmtWSPort" 
    implementor="com.xyz.abc.customermgmt.services.impl.CustomerMgmtWSImpl"
/>.

I even included these in context file. 

<import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />

I am creating service as a osgi bundle(jar file) and deploying it into
service mix.
I included cxf in import package and required bundle too.

 When i try to install bundle,  i am getting ServiceConstructionException. 
How can i fix this problem? Suggestions please. Does it require any HTTP
transport? How can i make it to work to take address from context. Do i need
to install anything more?

Root cause is 

Caused by: java.net.MalformedURLException: no protocol:
/XYZCustomerMgmtWSPort
    at java.net.URL.<init>(URL.java:567)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:92)
    at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:99)
    at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:86)
    at
org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:132)
    at
org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:92)
    at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:71)
    at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:149)
    ... 45 more

Thanks,
Potti


--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-Webservice-in-servicemix-with-cxf-and-install-as-a-osgi-bundle-tp5710339.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Creating Webservice in servicemix with cxf and install as a osgi bundle

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

Yeah, Johan is correct.

You use
<import resource="classpath:META-INF/cxf/cxf-extension-http- 
jetty.xml" />
which means you use jetty transport, so the address should be  
http://.....blabla.

But if you wanna use address like /XYZCustomerMgmtWSPort, which means  
you use http-osgi transport, you need have
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
instead.

Btw, since from SMX4.4, you even needn't have cxf-extension-xxx.xml at  
all, you just specify address /XYZCustomerMgmtWSPort or http://blabla  
and CXF bus can load correct transport for you accordingly.

Freeman
On 2012-5-16, at 上午4:11, Johan Edstrom wrote:

> Add http-transport-osgi or set the http://0.0.0.0:port part.
>
>
> On May 15, 2012, at 1:45 PM, nareshkpotti wrote:
>
>> I am trying to create a web service using service mix 4.3, apache  
>> cxf 2.3 and
>> spring 3.0.5.I am following WSDL first method for this I created a  
>> WSDL and
>> generated code from it and I am writing web service implementation in
>> generated implementation class and defining endpoint in context  
>> file as
>>
>>   <jaxws:endpoint id="XYZCustomerMgmtWS"
>>   address="/XYZCustomerMgmtWSPort"
>>    
>> implementor 
>> ="com.xyz.abc.customermgmt.services.impl.CustomerMgmtWSImpl"
>> />.
>>
>> I even included these in context file.
>>
>> <import resource="classpath:META-INF/cxf/cxf.xml" />
>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>> <import resource="classpath:META-INF/cxf/cxf-extension-http- 
>> jetty.xml" />
>>
>> I am creating service as a osgi bundle(jar file) and deploying it  
>> into
>> service mix.
>> I included cxf in import package and required bundle too.
>>
>> When i try to install bundle,  i am getting  
>> ServiceConstructionException.
>> How can i fix this problem? Suggestions please. Does it require any  
>> HTTP
>> transport? How can i make it to work to take address from context.  
>> Do i need
>> to install anything more?
>>
>> Root cause is
>>
>> Caused by: java.net.MalformedURLException: no protocol:
>> /XYZCustomerMgmtWSPort
>>   at java.net.URL.<init>(URL.java:567)
>>   at java.net.URL.<init>(URL.java:464)
>>   at java.net.URL.<init>(URL.java:413)
>>   at
>> org 
>> .apache 
>> .cxf 
>> .transport 
>> .http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:92)
>>   at
>> org 
>> .apache 
>> .cxf 
>> .transport 
>> .http_jetty 
>> .JettyHTTPTransportFactory 
>> .createDestination(JettyHTTPTransportFactory.java:99)
>>   at
>> org 
>> .apache 
>> .cxf 
>> .transport 
>> .http_jetty 
>> .JettyHTTPTransportFactory 
>> .getDestination(JettyHTTPTransportFactory.java:86)
>>   at
>> org 
>> .apache 
>> .cxf 
>> .binding 
>> .soap.SoapTransportFactory.getDestination(SoapTransportFactory.java: 
>> 132)
>>   at
>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java: 
>> 92)
>>   at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:71)
>>   at
>> org 
>> .apache 
>> .cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:149)
>>   ... 45 more
>>
>> Thanks,
>> Potti
>>
>>
>> --
>> View this message in context: http://servicemix.396122.n5.nabble.com/Creating-Webservice-in-servicemix-with-cxf-and-install-as-a-osgi-bundle-tp5710339.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>

---------------------------------------------
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











Re: Creating Webservice in servicemix with cxf and install as a osgi bundle

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

My comment inline.
On 2012-5-16, at 上午4:58, nareshkpotti wrote:

> Thank you for response. How can i use http-transport-osgi? Is it by  
> adding
> <import resource="classpath:META-INF/cxf/osgi/cxf-extension- 
> osgi.xml" /> to
> context file.
have
<import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath:META-INF/cxf/osgi/cxf-extension- 
osgi.xml" />
should be fine
>
> How can i specify to use both jetty transport and osgi transport?  
> Are these
> imports sufficient?
> <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-extension-http- 
> jetty.xml" />
>  <import resource="classpath:META-INF/cxf/osgi/cxf-extension- 
> osgi.xml" />
No, you can't use both transport for a certain endpoint, it will use  
http-osgi or http-jetty transport.
Freeman
>
> Thanks,
> Potti
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Creating-Webservice-in-servicemix-with-cxf-and-install-as-a-osgi-bundle-tp5710339p5710395.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

---------------------------------------------
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











Re: Creating Webservice in servicemix with cxf and install as a osgi bundle

Posted by nareshkpotti <po...@gmail.com>.
Thank you for response. How can i use http-transport-osgi? Is it by adding 
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" /> to
context file.

How can i specify to use both jetty transport and osgi transport? Are these
imports sufficient?
<import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
  <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

Thanks,
Potti

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-Webservice-in-servicemix-with-cxf-and-install-as-a-osgi-bundle-tp5710339p5710395.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Creating Webservice in servicemix with cxf and install as a osgi bundle

Posted by Johan Edstrom <se...@gmail.com>.
Add http-transport-osgi or set the http://0.0.0.0:port part.


On May 15, 2012, at 1:45 PM, nareshkpotti wrote:

> I am trying to create a web service using service mix 4.3, apache cxf 2.3 and
> spring 3.0.5.I am following WSDL first method for this I created a WSDL and
> generated code from it and I am writing web service implementation in
> generated implementation class and defining endpoint in context file as 
> 
>    <jaxws:endpoint id="XYZCustomerMgmtWS" 
>    address="/XYZCustomerMgmtWSPort" 
>    implementor="com.xyz.abc.customermgmt.services.impl.CustomerMgmtWSImpl"
> />.
> 
> I even included these in context file. 
> 
> <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
> 
> I am creating service as a osgi bundle(jar file) and deploying it into
> service mix.
> I included cxf in import package and required bundle too.
> 
> When i try to install bundle,  i am getting ServiceConstructionException. 
> How can i fix this problem? Suggestions please. Does it require any HTTP
> transport? How can i make it to work to take address from context. Do i need
> to install anything more?
> 
> Root cause is 
> 
> Caused by: java.net.MalformedURLException: no protocol:
> /XYZCustomerMgmtWSPort
>    at java.net.URL.<init>(URL.java:567)
>    at java.net.URL.<init>(URL.java:464)
>    at java.net.URL.<init>(URL.java:413)
>    at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:92)
>    at
> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:99)
>    at
> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:86)
>    at
> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:132)
>    at
> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:92)
>    at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:71)
>    at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:149)
>    ... 45 more
> 
> Thanks,
> Potti
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Creating-Webservice-in-servicemix-with-cxf-and-install-as-a-osgi-bundle-tp5710339.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.