DroleDeCerfeuil
06-06-2007, 01:00 PM
Hi
I would like to expose a class as a web service which contains two methods with the same name but a different argument type (string / int). Thoose methods looks something like this :
public bool DeleteTranslation(int pIntID){
...
}
public bool DeleteTranslation(string pstrId){
...
}
When I do this, WebServiceHandlerFactory throws an exception : {"Boolean DeleteTranslation(Int32) et Boolean DeleteTranslation(System.String) utilisent tous les deux le nom de message 'DeleteTranslation'. Utilisez la propriété MessageName de l'attribut personnalisé de la WebMethod pour spécifier des noms de message uniques pour les méthodes."} (Sorry it's in french ...) It means that the two methods use the same message name.
I tried to define a custom message name using a code like this :
<object id="businessElementWebService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="businessElementService" />
<property name="Namespace" value="http://iNovaShell/WebServices" />
<property name="Description" value="iNovaShell Web Services" />
<property name="MemberAttributes">
<dictionary>
<entry key="DeleteTranslation">
<object type="System.Web.Services.WebMethodAttribute, System.Web.Services">
<property name="Description" value="Delete a translation"/>
<property name="MessageName" value="OneDeleteTranslationMethod"/>
</object>
</entry>
</dictionary>
</property>
</object>
But as I thought the same exception was thrown.
I don't want to add the [WebService] and [WebMethod...] attributes to my service class...
How could I define differents Message Name for thoose methods ?? Thanks a lot.
Fred
PS: sorry for my horrible English ...
I would like to expose a class as a web service which contains two methods with the same name but a different argument type (string / int). Thoose methods looks something like this :
public bool DeleteTranslation(int pIntID){
...
}
public bool DeleteTranslation(string pstrId){
...
}
When I do this, WebServiceHandlerFactory throws an exception : {"Boolean DeleteTranslation(Int32) et Boolean DeleteTranslation(System.String) utilisent tous les deux le nom de message 'DeleteTranslation'. Utilisez la propriété MessageName de l'attribut personnalisé de la WebMethod pour spécifier des noms de message uniques pour les méthodes."} (Sorry it's in french ...) It means that the two methods use the same message name.
I tried to define a custom message name using a code like this :
<object id="businessElementWebService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="businessElementService" />
<property name="Namespace" value="http://iNovaShell/WebServices" />
<property name="Description" value="iNovaShell Web Services" />
<property name="MemberAttributes">
<dictionary>
<entry key="DeleteTranslation">
<object type="System.Web.Services.WebMethodAttribute, System.Web.Services">
<property name="Description" value="Delete a translation"/>
<property name="MessageName" value="OneDeleteTranslationMethod"/>
</object>
</entry>
</dictionary>
</property>
</object>
But as I thought the same exception was thrown.
I don't want to add the [WebService] and [WebMethod...] attributes to my service class...
How could I define differents Message Name for thoose methods ?? Thanks a lot.
Fred
PS: sorry for my horrible English ...