Hi, here is the problem I am trying to solve: I have couple web application
and each of them publishes an XFire web service using Spring.
 
<beans>
     <bean id="federatedBean"
class="com.roh.oculus.ws.xfire.FederatedServiceImpl"/>
</beans>

<bean id="federated"
class="org.codehaus.xfire.spring.remoting.XFireExporter">
        <property name="serviceFactory">
            <ref bean="xfire.serviceFactory"/>
        </property>
        <property name="xfire">
            <ref bean="xfire"/>
        </property>
        <property name="serviceBean">
            <ref bean="federatedBean"/>
        </property>
        <property name="serviceClass">
            <value>ws.xfire.FederatedService</value>
        </property>
        <property name="properties">
             <map>
                 <entry>
                     <key><value>mtom-enabled</value></key>
                     <value>true</value>
                 </entry>
             </map>
         </property> 
    </bean>


My service ws.xfire.FederatedServiceImpl declares a method

 public DataHandler getDocument(String guid) {
        logger.debug("getDocument() start");
        DataSource source = new FileDataSource("C:/temp/b5diagn.txt");
        logger.debug("getDocument() finish");
        return new DataHandler(source);
    }

I have a java application which talks to all services. Clients are created
via spring remouting 

<bean id="serviceMgr"
class="com.roh.oculus.globalization.WebServiceManager">         
        <property name="webServices">
                <list>
                        <!-- <ref local="Oculus-Local"/> -->
                         <ref local="Oculus-Remote"/>
                </list>
        </property>     
    </bean>
    <!-- XFire services
    <bean id="Oculus-Local"
class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
                <property name="serviceClass">
                        <value>com.roh.oculus.ws.xfire.FederatedService</value>
                </property>
                <property name="wsdlDocumentUrl"
value="http://192.168.253.59:8080/Oculus5/services/FederatedService?wsdl"/>
                <property name="url"
value="http://192.168.253.59:8080/Oculus5/services/FederatedService"; />         
                <property name="lookupServiceOnStartup" value="false"/>
        </bean>
        -->
        <bean id="Oculus-Remote"
class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
                <property name="serviceClass">
                        <value>com.roh.oculus.ws.xfire.FederatedService</value>
                </property>
                <property name="wsdlDocumentUrl"
value="http://192.168.253.174:8080/Oculus5/services/FederatedService?wsdl"/>
                <property name="url"
value="http://192.168.253.174:8080/Oculus5/services/FederatedService"; />        
        
                <property name="lookupServiceOnStartup" value="false"/>
                <property name="properties">
             <map>
                 <entry>
                     <key><value>mtom-enabled</value></key>
                     <value>true</value>
                 </entry>
                 <entry>
                        
<key><value>urn:xfire:transport:http:chunking-enabled</value></key>
                        <value>true</value>
                 </entry>
             </map>
         </property> 
        </bean>
</beans>

If I call getDocument("xx") method  I expect to receive a file and save it.
Here is how I am handling the request to remote web service:

for(FederatedService fs: getWebServices()) {
                logger.debug("Loading document from service...");
                DataHandler handler = fs.getDocument(guid);
                logger.debug("Handler is here.....");
                InputStream is = handler.getInputStream();
                logger.debug("Inputstream is here");
                if (is instanceof DeleteOnCloseFileInputStream) {
                     logger.debug("tell XFire not to delete the file");
                    ((DeleteOnCloseFileInputStream)is).setDelete(false);
                  }
                AttachmentDataSource attSource = (AttachmentDataSource)
handler.getDataSource();
                File file = attSource.getFile();
                logger.debug(file.getName()+"is downloaded on client side");
                logger.debug("path to file: "+file.getAbsolutePath());
            }

When my program locate an apporpriate service, it calls getDocument(), but
the call throws an exception..... The error log is follows:

[18 16:10:15.953] DEBUG [OFSModSearch] - Starting file download.....
[18 16:10:15.953] DEBUG [OFSModSearch] - Loading document from service...
Exception in thread "AWT-EventQueue-0"
org.codehaus.xfire.XFireRuntimeException: Exception while calling:
http://192.168.253.174:8080/Oculus5/services/FederatedService arguments:
java.lang.String : aa.aa |. Nested exception is
org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
        at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:391)
        at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
        at 
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
        at org.codehaus.xfire.client.Client.invoke(Client.java:335)
        at 
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy1.getDocument(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.xfire.spring.remoting.XFireClientFactoryBean$ProxyInterceptor.invoke(XFireClientFactoryBean.java:604)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
        at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
        at $Proxy0.getDocument(Unknown Source)
        at
com.roh.oculus.globalization.gui.OFSModSearch.downloadFile(OFSModSearch.java:380)
        at
com.roh.oculus.globalization.gui.OFSModSearch.access$100(OFSModSearch.java:65)
        at
com.roh.oculus.globalization.gui.OFSModSearch$3$1.run(OFSModSearch.java:364)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.lang.NullPointerException
        at
org.codehaus.xfire.attachments.AttachmentUtil.getAttachment(AttachmentUtil.java:33)
        at
org.codehaus.xfire.aegis.type.mtom.AbstractXOPType.readInclude(AbstractXOPType.java:58)
        at
org.codehaus.xfire.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:45)
        at
org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:162)
        at
org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
        at
org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50)
        at
org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:387)
        ... 28 more


It seems like I am doing something wrong. What is the error? How can I
receive a file from webservice?


Regards


-- 
View this message in context: 
http://www.nabble.com/Spring-Xfire-Mtom.-How-to-transfer-file--tf3603236.html#a10066446
Sent from the XFire - User mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email

Reply via email to