You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mule1 <ua...@yahoo.com> on 2007/10/09 03:35:48 UTC
cxf plain xml http configuration using simple frontend
Hello,
I wanted to configure my services for exposing my service for plain xml over
http by using the simple frontend configuration instead of jaxws. How can I
do that?
I saw that using jaxws, I can do this, but I want my webservices configured
without annotations - so, want to do it with simple frontend.
An example I saw for configuration using jaxws:
<jaxws:endpoint
id="hello_world_xml"
implementor="demo.hw.server.GreeterImpl"
address="/xml"
bindingUri="http://cxf.apache.org/bindings/xformat">
</jaxws:endpoint>
Thanks.
--
View this message in context: http://www.nabble.com/cxf-plain-xml-http-configuration-using-simple-frontend-tf4591639.html#a13107892
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf plain xml http configuration using simple frontend
Posted by Willem2 <ni...@iona.com>.
Hi ,
For Question 1: Can you show me the SEI and wsdl ?
For Question 2: It looks like the xformat binding is not found by bus,
Please check your class path which should contain the
cxf-rt-bindings-xml*.jar.
BTW, you can create a JIAR and attach your SEI and wsdl to this JIRA.
A simple test case to show this issue will be greate, so I can investigate
it easily.
Willem.
mule1 wrote:
>
> Willem,
>
> Thanks. After setting up this on server side, I encountered several
> problems for the client setup - so, I was trying few different options:
>
> 1. I setup my client configuration to be wsdl first as follow:
> <simple:client id="helloClient"
> serviceClass="com.comp.HelloWorld"
> address="http://localhost:8080/apps/xml/xhello"
> serviceName="s:HelloWorldService"
> xmlns:s="http://comp.com/"
> wsdlLocation="xhello.wsdl"
> bindingId="http://cxf.apache.org/bindings/xformat">
> </simple:client>
>
> with this setup, on test execution, I get following error:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'queryXmlClient': Instantiation of bean failed; nested
> exception is
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory
> method [public java.lang.Object
> org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
> nested exception is
> org.apache.cxf.service.factory.ServiceConstructionException: Could not
> find a matching method for operation {http://comp.com/}sayHi
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
> Factory method [public java.lang.Object
> org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
> nested exception is
> org.apache.cxf.service.factory.ServiceConstructionException: Could not
> find a matching method for operation {http://comp.com/}sayHi
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
> Could not find a matching method for operation {http://comp.com/}sayHi
> at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:324)
> at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:214)
>
>
> Upon looking at the cxf source code for DefaultServiceConfiguration.java,
> seems following lines of code is an issue in getOperationName() method:
> if (service.getOperation(name) == null) {
> return name;
> }
> seems instead of check for "==null", it should check for "!= null"? Else
> if this code is correct, not sure what configuration setup I am missing to
> make this work.
>
>
> 2. Since above setup for client didn't work, I tried following in my Test
> code directly:
>
> JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
> sf.setServiceClass(HelloWorld.class);
> sf.getServiceFactory().setWrapped(false);
>
> sf.getClientFactoryBean().setBindingId("http://cxf.apache.org/bindings/xformat");
> sf.setAddress("http://localhost:8080/apps/xml/xhello");
> sf.setWsdlLocation("xhello.wsdl");
> HelloWorld cs = (HelloWorld)sf.create();
>
> I get following error:
> Caused by: org.apache.cxf.BusException: No binding factory for namespace
> registered.
> at
> org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:82)
> at
> org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:100)
> at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:50)
>
> It seems the namespace it is looking for is empty string? What do I need
> to do to make the client work but still do wsdl first - meaning set the
> WsdlLocation on service factory?
>
> Thanks.
>
>
>
--
View this message in context: http://www.nabble.com/cxf-plain-xml-http-configuration-using-simple-frontend-tf4591639.html#a13153343
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf plain xml http configuration using simple frontend
Posted by mule1 <ua...@yahoo.com>.
Willem,
Thanks. After setting up this on server side, I encountered several problems
for the client setup - so, I was trying few different options:
1. I setup my client configuration to be wsdl first as follow:
<simple:client id="helloClient"
serviceClass="com.comp.HelloWorld"
address="http://localhost:8080/apps/xml/xhello"
serviceName="s:HelloWorldService"
xmlns:s="http://comp.com/"
wsdlLocation="xhello.wsdl"
bindingId="http://cxf.apache.org/bindings/xformat">
</simple:client>
with this setup, on test execution, I get following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'queryXmlClient': Instantiation of bean failed; nested exception
is org.springframework.beans.factory.BeanDefinitionStoreException: Factory
method [public java.lang.Object
org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
nested exception is
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
a matching method for operation {http://comp.com/}sayHi
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public java.lang.Object
org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
nested exception is
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
a matching method for operation {http://comp.com/}sayHi
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find a matching method for operation {http://comp.com/}sayHi
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:324)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:214)
Upon looking at the cxf source code for DefaultServiceConfiguration.java,
seems following lines of code is an issue in getOperationName() method:
if (service.getOperation(name) == null) {
return name;
}
seems instead of check for "==null", it should check for "!= null"? Else if
this code is correct, not sure what configuration setup I am missing to make
this work.
2. Since above setup for client didn't work, I tried following in my Test
code directly:
JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
sf.setServiceClass(HelloWorld.class);
sf.getServiceFactory().setWrapped(false);
sf.getClientFactoryBean().setBindingId("http://cxf.apache.org/bindings/xformat");
sf.setAddress("http://localhost:8080/apps/xml/xhello");
sf.setWsdlLocation("xhello.wsdl");
HelloWorld cs = (HelloWorld)sf.create();
I get following error:
Caused by: org.apache.cxf.BusException: No binding factory for namespace
registered.
at
org.apache.cxf.binding.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:82)
at
org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:100)
at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:50)
It seems the namespace it is looking for is empty string? What do I need to
do to make the client work but still do wsdl first - meaning set the
WsdlLocation on service factory?
Thanks.
--
View this message in context: http://www.nabble.com/cxf-plain-xml-http-configuration-using-simple-frontend-tf4591639.html#a13146975
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf plain xml http configuration using simple frontend
Posted by Willem Jiang <ni...@iona.com>.
It is same with the jaxws:endpoint.
You need to create a service factory bean and set it to the simple:server.
Here is an example
<bean id="ReflectionServiceFactoryBean"
class="org.apache.cxf.service.factory.ReflectionServiceFactoryBean">
<property name="wrapped" value="true"/>
</bean>
<simple:server id="inlineImplementor"
address="http://localhost:8080/simpleWithAddress">
<simple:serviceBean>
<bean class="org.apache.cxf.service.factory.HelloServiceImpl"/>
</simple:serviceBean>
<simple:serviceFactory>
<bean ref="ReflectionServiceFactoryBean">
</simple:serviceFactory>
</simple:server>
BTW, You need to specify different simple:serviceFactory for different
simple:server.
You can find more information here.
http://www.nabble.com/deploy-webservices-tf4591636.html#a13107881
Willem.
mule1 wrote:
> Willem - Thanks. I configured it using that example. With this simple
> frontend, how can I set 'wrapped" = true?
>
Re: cxf plain xml http configuration using simple frontend
Posted by mule1 <ua...@yahoo.com>.
Willem - Thanks. I configured it using that example. With this simple
frontend, how can I set 'wrapped" = true?
--
View this message in context: http://www.nabble.com/cxf-plain-xml-http-configuration-using-simple-frontend-tf4591639.html#a13117511
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf plain xml http configuration using simple frontend
Posted by Willem Jiang <ni...@iona.com>.
Hi,
You can use the simple:server tag for it.
Here are some examples for it [1]
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml
Willem.
mule1 wrote:
> Hello,
>
> I wanted to configure my services for exposing my service for plain xml over
> http by using the simple frontend configuration instead of jaxws. How can I
> do that?
>
> I saw that using jaxws, I can do this, but I want my webservices configured
> without annotations - so, want to do it with simple frontend.
>
> An example I saw for configuration using jaxws:
> <jaxws:endpoint
> id="hello_world_xml"
> implementor="demo.hw.server.GreeterImpl"
> address="/xml"
> bindingUri="http://cxf.apache.org/bindings/xformat">
> </jaxws:endpoint>
>
> Thanks.
>