Bonjour,

J'ai essayé d'écrire un petit webservice qui permet de transférer des fichiers via MTOM.
Malheureusement, je n'obtiens qu'une erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
Avertissement: Interceptor for {http://mediStor.org/x-rays/storeImpl/CXF}XRayStorageService#{http://mediStor.org/x-rays/storeImpl/CXF}store has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:243)
	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:62)
(j'essaie d'implémenter l'exemple présenté dans http://cxf.apache.org/docs/mtom.html )

J'ai cru que je n'avais pas activer les mtom, mais je l'ai fait et j'ai toujours la même erreur (il se peut que je ne le fasse pas correctement) :

Code Configuration serveur : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<bean id="impl" class="org.medistor.x_rays.storeimpl.cxf.XRayStorageImpl" />
 
<jaxws:server serviceClass="org.medistor.x_rays.storeimpl.cxf.XRayStorage" serviceBean="#impl">
	<jaxws:properties>
		<entry key="mtom-enabled" value="true"></entry>
	</jaxws:properties>
</jaxws:server>

Code configuration client : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("http://localhost:8080/Server");
factory.setServiceClass(XRayStorage.class);		    
 
@SuppressWarnings("restriction")
BindingProvider clientBP = (BindingProvider) factory.create();
SOAPBinding binding = (SOAPBinding)clientBP.getBinding();
binding.setMTOMEnabled(true);
 
XRayStorage client = (XRayStorage) clientBP;