History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-179
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Dan Diephouse
Reporter: Gareth Davies
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XFire

Allow javax.xml.stream.XMLStreamReader return type for Message-style services

Created: 21/Nov/05 12:36 PM   Updated: 08/Dec/05 08:51 AM
Component/s: Core
Affects Version/s: None
Fix Version/s: 1.0-M6, 1.0-RC

Time Tracking:
Not Specified

Environment: All


 Description  « Hide
We have a suite of document-literal (aka message) SOAP services exposed via Apache Axis 1.2. We have been experimenting with XFire as an alternative, lighter weight SOAP engine, following a general trend at my current client toward streaming XML using StAX. To this end, we use the org.codehaus.xfire.service.binding.MessageBindingProvider with our ObjectServiceFactory instance and then defined our common endpoint interface as:

public interface XFireMessageEndpoint { public XMLStreamReader execute(XMLStreamReader xmlReader, MessageContext context) throws XFireFault; }

However, the MessageBindingProvider.writeParameter() method only recognizes a return type of org.codehaus.yom.Element - many of our response payloads originate from other XML-emitting services in the SOA environment, so we wanted to just pass the stream through to the XFire engine, without converting it to some sort of document object first. This could be achieved by replacing the current MessageBindingProvider.writeParameter() implementation with (for example):

if (value instanceof Element)
{
StaxSerializer serializer = new StaxSerializer();
try

{ serializer.writeElement((Element) value, writer); }

catch (XMLStreamException e)
{ throw new XFireRuntimeException("Couldn't write to stream.", e); }
}
// Patch begins!
else if (value instanceof XMLStreamReader)
{
try
{ STAXUtils.copy((XMLStreamReader) value, writer); }
catch (XMLStreamException e)
{ throw new XFireRuntimeException("Couldn't write to stream.", e); } }
}
// Patch ends!
else

{ logger.warn("Unknown type for serialization: " + p.getTypeClass()); }

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dan Diephouse - 08/Dec/05 08:51 AM
This has been in CVS for a bit now