Well, you can write services using the Provider interface that
send/receive SOAPMessage objects.

http://cwiki.apache.org/CXF20DOC/provider-services.html

Then, you could call getSOAPBody() on the soap message to get a
SOAPBody object, which implements org.w3c.dom.Node:

http://java.sun.com/webservices/docs/1.5/api/javax/xml/soap/SOAPBody.html

Next you can create a DOMSource from the SOAPBody:

http://java.sun.com/webservices/docs/1.5/api/javax/xml/transform/dom/DOMSource.html

Finally you can use an XMLInputFactory to create an XMLStreamReader
from the DOMSource:

http://java.sun.com/webservices/docs/1.5/api/javax/xml/stream/XMLInputFactory.html#createXMLStreamReader(javax.xml.transform.Source)

A bit long winded, but as far as I know that's the simplest way to get
an XMLStreamReader.

Unfortunately, this does mean that the whole message has to get loaded
into a DOM tree in order to be operated on, rather than just streaming
the data in from the web server on demand. Shouldn't be a problem for
small messages but is a shame for large amounts of data.

Does anybody know a way around this, so you can get an XMLStreamReader
directly without going via DOM?

Andrew.

2008/12/12 Rao, Sameer V <[email protected]>:
>
>
>  I wanted to expose a class as a service that can has operations which take 
> in XMLStreamReader. This is more for migrating Xfire service/classes.
>
>  public class AXMLStreamBasedService {
>
>      public XMLStreamReader operationOne (XMLStreamReader request) {
>            //TODO
>            return null;
>      }
>
>      public XMLStreamReader operationTwo (XmlStreamReader request) {
>            //TODO
>            return null;
>      }
>
>
>
>  }
>
>
> -----Original Message-----
> From: Benson Margulies [mailto:[email protected]]
> Sent: Thu 12/11/2008 7:21 PM
> To: [email protected]
> Subject: Re: CXF Service using XMLStreamReader as input and output
>
> I don't understand what you are trying to do. An 'exposed' service is
> exposed via HTTP, or some other network protocol. Can you provide a
> more detailed view of the gazintas and the gazoutas?
>
> On Thu, Dec 11, 2008 at 6:14 PM, Rao, Sameer V <[email protected]> wrote:
>>
>>  Hi,
>>
>> I am not able to find documentation/sample that illustrates how to
>> expose a service (Java First approach) that takes in XMLStreamReader as
>> input and return XMLSTreamReader?
>>
>> Is there any sample?
>>
>>
>> Thanks,
>> Sam
>>
>
>
>
>
> -----Original Message-----
> From: Benson Margulies [mailto:[email protected]]
> Sent: Thu 12/11/2008 7:21 PM
> To: [email protected]
> Subject: Re: CXF Service using XMLStreamReader as input and output
>
> I don't understand what you are trying to do. An 'exposed' service is
> exposed via HTTP, or some other network protocol. Can you provide a
> more detailed view of the gazintas and the gazoutas?
>
> On Thu, Dec 11, 2008 at 6:14 PM, Rao, Sameer V <[email protected]> wrote:
>>
>>  Hi,
>>
>> I am not able to find documentation/sample that illustrates how to
>> expose a service (Java First approach) that takes in XMLStreamReader as
>> input and return XMLSTreamReader?
>>
>> Is there any sample?
>>
>>
>> Thanks,
>> Sam
>>
>
>

Reply via email to