Good afternoon!

I'm in the process of setting up a webservice using Spring/XFire. I am able to get it working fine with a simple String input parameter, but when I try to use the XMLStreamReader for Message Binding, my tests seem to fail.

First, here is my test:

===============
        public void testLiveServerXml() throws Exception {

                XMLInputFactory factory = XMLInputFactory.newInstance();
                XMLStreamReader reader = factory.createXMLStreamReader(
                                new FileReader("C:\\testMessage.xml"));

                ObjectServiceFactory serviceFactory = new 
ObjectServiceFactory();
                serviceFactory.setStyle("message");
                Service serviceModel = 
serviceFactory.create(AggregatorService.class);

AggregatorService service = (AggregatorService)new XFireProxyFactory().create( serviceModel, "http://localhost:8888/caps2/services/AggregatorService?wsdl";);

                XMLStreamReader result = service.invoke(reader);
                assertNotNull(result);
                assertEquals("OK", result.getText());
        }
===============

The service.invoke method executes, however, debugging shows that the service method on the server is never called (maybe it's failing somewhere in the proxy?). The end result is that the test fails because the "result" is null.

Here then, is my Service
=====================
public class AggregatorServiceImpl implements AggregatorService {

        private Log logger = LogFactory.getLog(AggregatorServiceImpl.class);

        public XMLStreamReader invoke(XMLStreamReader reader) {

                XMLStreamReader result = null;

                try {
                        logger.info("in XMLStreamReader invoke");
                        logger.info("reader data: [" + reader.getText() + "]");

                        XMLInputFactory factory = XMLInputFactory.newInstance();
                        result = factory.createXMLStreamReader(new 
StringReader("OK"));
                }
                catch (Exception e) {
                        logger.error("Exception!", e);
                }

                return result;
        }
}
=====================

The service has an associated interface, which i won't include here.

Finally, my spring configuration:

======================
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

        <!-- Include the XFire goodness -->
        <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />

        <bean name="aggregator-webservice"
                class="org.codehaus.xfire.spring.ServiceBean">
                <property name="serviceBean" ref="aggregatorService" />
<property name="serviceClass" value="com.me.caps.aggregator.service.AggregatorService" />

<bean id="aggregatorService" class="com.me.caps.aggregator.service.impl.AggregatorServiceImpl" />

</beans>
========================

Does anyone have any tips on what might be happening?

Thanks!
---
Nayan Hajratwala
http://www.chikli.com  Chikli Consulting LLC







---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to