XFire et Méthodes sans Paramètre
Bonjour à tous, je suis en face d'un problème assez curieux et je trouve pas de réponses sur les forums.
En effet, je développe une application Spring exposant ses services via XFire.
Pour cela, je crée mon interface
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
package com.afrikbrain.smsalert.providers.mail.ws.interfaces;
/**
* Interface du service web
* @author Jean-Jacques
* @version 2.0
*/
public interface IHello {
public String sayHello(String user) ;
public void goodBye() ;
} |
Ensuite je crée mon implémentation
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
package com.afrikbrain.smsalert.providers.mail.ws;
/**
* Implementation du service web
* @author Jean-Jacques
* @version 2.0
*/
public class Hello implements IHello {
@Override
public String sayHello(String user) {
// Execution
return "Bonjour " + user;
}
public void goodBye() {
System.out.println("Aurevoir");
}
} |
Je configure ensuite ces Bean dans le Fichier applicationContext.xml
Code:
1 2 3 4 5 6 7 8 9
|
<?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">
<bean name="HelloWS" class="com.afrikbrain.smsalert.providers.mail.ws.Hello" />
</beans> |
Je configure ensuite mon Service eb dans le fichier xfire-servlet.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
<?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">
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
<import resource="applicationContext.xml"/>
<bean id="xfireServiceTemplate" class="org.codehaus.xfire.spring.remoting.XFireExporter" abstract="true">
<property name="serviceFactory" ref="xfire.serviceFactory" />
<property name="xfire" ref="xfire" />
<property name="style" value="document" />
<property name="use" value="literal" />
</bean>
<bean name="/HelloWS" parent="xfireServiceTemplate">
<property name="serviceBean" ref="HelloWS" />
<property name="serviceInterface" value="com.afrikbrain.smsalert.providers.mail.ws.interfaces.IHello" />
</bean>
</beans> |
Enfin, je configure mon fichier web.xml de façon vraiment standard.
Le déploiement se passe très bien et je construit bien mon client (en utilisant le plugin eclipse).
Le problème survient lorsque j'appelle mon service, l'appel se passe bien pour la méthode avec paramètre
Code:
public String sayHello(String user)
mais lorsque j'apelle la méthode sans parametre
Code:
public void goodBye() ;
j'obtien une exception dont la trace est la suivante:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: Parameter goodBye does not exist!
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Parameter goodBye does not exist!
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812) |
Je ne saist pas si la gestion des méthodes sans paramètre pose un problème particulier avec les Web Service et Axis.