I created a JAX-WS client to call my CXF web service (using NetBeans standard
stuff).
The service interface looks like this:
public interface TheService {
public Object[] sayHi();
}
The implementing class returns an array containing two strings: "hello" and
"world".
The JAX-WS client calls the service successfully, but instead of returning an
Object[], it returns a List of DOM nodes.
Is there a way I can have the nodes unmarshalled automatically?
I'll try this with a CXF client in the mean time.
Thanks for your help.
- Ian
----- Original Message ----
From: Ian McDonagh <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, 31 July, 2008 8:16:55 AM
Subject: Re: Help: POJO + Servlet transport
Awesome! That did the trick.
Thanks for your help.
I'll be testing with various clients now (JAX-WS, .NET, Axis, etc.). My
experience with XFire was fantastic, so I expect CXF will be just as good.
I think what was a little overwhelming at first is that CXF is comprised of
more than one API. All in all though, its all good.
As a matter of interest, I did the following in my servlet:
Bus bus = getBus();
ServiceFactoryBean f = ...
f.setBus(bus);
This seems to be equivalent to BusFactory.setDefaultBus(bus), except of course
that BusFactory.setDefaultBus(bus) is less coding in that you don't have to
call setBus() on each server factory you create.
Thanks once again for your assistance.
- Ian
----- Original Message ----
From: Daniel Kulp <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, 30 July, 2008 4:32:23 PM
Subject: Re: Help: POJO + Servlet transport
You might need to force it into http mode:
f.setTransportId("http://schemas.xmlsoap.org/soap/http");
Dan
On Jul 30, 2008, at 8:41 AM, Ian McDonagh wrote:
> Dan, thanks for your help.
>
> I tried the following:
>
> Bus bus = getBus();
> BusFactory.setDefaultBus(bus);
> ServerFactoryBean f = new ServerFactoryBean();
> f.setServiceClass(MyService.class);
> f.setServiceBean(new MyService());
> f.setAddress("/MyService");
> f.create();
>
> I get the following error when I call
> http://myserver/warname/services/MyService?wsdl
> :
>
>
> java.lang.NullPointerException
> javax.naming.InitialContext.getURLScheme(InitialContext.java:269)
>
> javax
> .naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:318)
> javax.naming.InitialContext.lookup(InitialContext.java:392)
>
> org
> .apache
> .cxf
> .transport
> .servlet
> .ServletContextResourceResolver
> .resolve(ServletContextResourceResolver.java:62)
>
> org
> .apache
> .cxf
> .resource
> .DefaultResourceManager.findResource(DefaultResourceManager.java:99)
>
> org
> .apache
> .cxf
> .resource
> .DefaultResourceManager.resolveResource(DefaultResourceManager.java:
> 55)
>
> org
> .apache
> .cxf
> .common
> .injection.ResourceInjector.resolveResource(ResourceInjector.java:400)
>
> org
> .apache
> .cxf
> .common.injection.ResourceInjector.visitMethod(ResourceInjector.java:
> 185)
>
> org
> .apache
> .cxf
> .common
> .annotation
> .AnnotationProcessor.processMethods(AnnotationProcessor.java:87)
>
> org
> .apache
> .cxf
> .common
> .annotation.AnnotationProcessor.accept(AnnotationProcessor.java:70)
>
> org
> .apache
> .cxf.common.injection.ResourceInjector.inject(ResourceInjector.java:
> 81)
>
> org
> .apache
> .cxf.common.injection.ResourceInjector.inject(ResourceInjector.java:
> 76)
>
> org
> .apache
> .cxf
> .bus
> .extension
> .ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:175)
>
> org
> .apache
> .cxf
> .bus
> .extension
> .ExtensionManagerImpl.activateViaNS(ExtensionManagerImpl.java:96)
>
> org
> .apache
> .cxf
> .bus
> .extension
> .ExtensionManagerImpl.activateAll(ExtensionManagerImpl.java:104)
> org.apache.cxf.bus.extension.DeferredMap.undefer(DeferredMap.java:36)
>
> org
> .apache
> .cxf
> .transport
> .DestinationFactoryManagerImpl
> .getDestinationFactoryForUri(DestinationFactoryManagerImpl.java:136)
>
> org
> .apache
> .cxf
> .frontend
> .AbstractWSDLBasedEndpointFactory
> .createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:160)
>
> org
> .apache
> .cxf
> .frontend
> .AbstractWSDLBasedEndpointFactory
> .createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
>
> org
> .apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
> 114)
> test.cxf.CxfServlet.loadBus(CxfServlet.java:33)
> Any ideas?
>
> Thanks once again for your assistance.
>
> - Ian
>
>
>
> ----- Original Message ----
> From: Daniel Kulp <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Wednesday, 30 July, 2008 2:27:27 PM
> Subject: Re: Help: POJO + Servlet transport
>
>
> That SHOULD be all that is necessary. You might need to add a:
>
> f.setAddress("/MyService");
>
> to make it start up on the right URL. (that would end up at:
> http://localhost:8080/warname/services/MyService)
>
>
> Dan
>
>
>
> On Jul 30, 2008, at 8:15 AM, Ian McDonagh wrote:
>
>> My servlet code looks like this:
>>
>> public class CxfServlet extends CXFNonSpringServlet {
>>
>> @Override
>> public void loadBus(ServletConfig servletConfig) throws
>> ServletException {
>> super.loadBus(servletConfig);
>>
>> Bus bus = getBus();
>> BusFactory.setDefaultBus(bus);
>> ServerFactoryBean f = new ServerFactoryBean();
>> f.setServiceClass(MyService.class);
>> f.setServiceBean(new MyService());
>> f.create();
>> ???
>> }
>>
>> }
>>
>> I'm missing the code that actually connects my service with the
>> servlet.
>>
>> How would I do that.
>>
>> Sorry for many questions.
>>
>> - Ian
>>
>>
>>
>>
>> ----- Original Message ----
>> From: Daniel Kulp <[EMAIL PROTECTED]>
>> To: [email protected]
>> Sent: Wednesday, 30 July, 2008 1:51:43 PM
>> Subject: Re: Help: POJO + Servlet transport
>>
>>
>> On Jul 30, 2008, at 7:37 AM, Ian McDonagh wrote:
>>
>>> I have created a servlet that subclasses CXFNonSpringServlet.
>>>
>>> I would like to make my POJO service class available via the servlet
>>> using the simple fontend.
>>>
>>> Is that possible?
>>>
>>
>> Yea, same way. Just use the
>> org.apache.cxf.frontend.ServerFactoryBean factory.
>>
>> Dan
>>
>>
>>
>>
>>> Thanks for your help.
>>>
>>> - Ian
>>>
>>>
>>>
>>> ----- Original Message ----
>>> From: Daniel Kulp <[EMAIL PROTECTED]>
>>> To: [email protected]
>>> Sent: Wednesday, 30 July, 2008 11:49:01 AM
>>> Subject: Re: Help: POJO + Servlet transport
>>>
>>>
>>> I see it at:
>>> http://cxf.apache.org/javadoc/2.1.1/org/apache/cxf/jaxws/JaxWsServerFactoryBean.html
>>>
>>> Dan
>>>
>>>
>>>
>>> On Jul 30, 2008, at 2:45 AM, Ian McDonagh wrote:
>>>
>>>> Hi Dan
>>>>
>>>> Thanks for your help.
>>>>
>>>> Strangely, the class JaxWsServerFactoryBean does not show up in the
>>>> javadocs. I'm using version 2.1.1.
>>>>
>>>> Am I missing something?
>>>>
>>>> - Ian
>>>>
>>>>
>>>>
>>>> ----- Original Message ----
>>>> From: Daniel Kulp <[EMAIL PROTECTED]>
>>>> To: [email protected]
>>>> Sent: Tuesday, 29 July, 2008 4:52:48 PM
>>>> Subject: Re: Help: POJO + Servlet transport
>>>>
>>>>
>>>> In your subclass, you can pretty much do whatever you want. You
>>>> can
>>>> use the JAX-WS Endpoint.create(....) stuff if you want. You can
>>>> use
>>>> the JaxWsServerFactoryBean. Etc.....
>>>>
>>>>
>>>> Dan
>>>>
>>>>
>>>> On Jul 29, 2008, at 9:25 AM, Ian McDonagh wrote:
>>>>
>>>>> Hi all
>>>>>
>>>>> I'd like to have a web service with the following configuration:
>>>>>
>>>>> Service interface and implementation: POJO (no annotations)
>>>>> Transport: HTTP Servlet (to be deployed to servlet container, eg.
>>>>> Tomcat)
>>>>> No dependency on Spring for configuration.
>>>>>
>>>>> Is this possible?
>>>>>
>>>>> From what I can tell, you need to subclass CXFNonSpringServlet,
>>>>> but
>>>>> I can't figure out how to publish the service.
>>>>>
>>>>> Do I have to use XML or can I do it with the API's only?
>>>>>
>>>>> Any help would be greatly appreciated.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Ian
>>>>>
>>>>>
>>>>>
>>>>> __________________________________________________________
>>>>> Not happy with your email address?.
>>>>> Get the one you really want - millions of new email addresses
>>>>> available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
>>>>
>>>> ---
>>>> Daniel Kulp
>>>> [EMAIL PROTECTED]
>>>> http://www.dankulp.com/blog
>>>>
>>>>
>>>> __________________________________________________________
>>>> Not happy with your email address?.
>>>> Get the one you really want - millions of new email addresses
>>>> available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
>>>
>>> ---
>>> Daniel Kulp
>>> [EMAIL PROTECTED]
>>> http://www.dankulp.com/blog
>>>
>>>
>>> __________________________________________________________
>>> Not happy with your email address?.
>>> Get the one you really want - millions of new email addresses
>>> available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
>>
>> ---
>> Daniel Kulp
>> [EMAIL PROTECTED]
>> http://www.dankulp.com/blog
>>
>>
>> __________________________________________________________
>> Not happy with your email address?.
>> Get the one you really want - millions of new email addresses
>> available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
>
> ---
> Daniel Kulp
> [EMAIL PROTECTED]
> http://www.dankulp.com/blog
>
>
> __________________________________________________________
> Not happy with your email address?.
> Get the one you really want - millions of new email addresses
> available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog
__________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at
Yahoo! http://uk.docs.yahoo.com/ymail/new.html
__________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at
Yahoo! http://uk.docs.yahoo.com/ymail/new.html