wcf soap problème de paramètre de type objet
Bonjour à tous :P
J'ai besoin de créer un bouchon en lieu et place d'un web service qui sera dev ultérieurement.
Je suis parti sur un service wcf.
Je pose le code en dessous (j'ai tout regroupé pour faire plus simple).
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 35
|
namespace WcfServiceLivePricing
{
[ServiceContract]
public interface IPricingToolService
{
[OperationContract]
String ZV37sdSalesorderSimulateM(TestObjParam paramAppel);
}
[DataContract]
public class TestObjParam
{
[DataMember]
public string toto { get; set; }
[DataMember]
public int titi { get; set; }
}
public class PricingToolService : IPricingToolService
{
public String ZV37sdSalesorderSimulateM(TestObjParam paramAppel)
{
System.Diagnostics.Debug.WriteLine(paramAppel.toto);
return toto;
}
......
} |
Et le xml qui est complètement figé et que je dois exploiter tel que pour l'appel :
Code:
1 2 3 4 5 6 7 8 9
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:ZV37sdSalesorderSimulateM>
<toto>45</toto>
<titi>66</titi>
</tem:ZV37sdSalesorderSimulateM>
</soapenv:Body>
</soapenv:Envelope> |
L'appel se fait bien mais le paramètre est systématiquement à null, d'ou mon post :oops:
Si je modifie le xml comme suit :
Code:
1 2 3 4 5 6 7 8 9 10 11
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:wcf="http://schemas.datacontract.org/2004/07/WcfServiceLivePricing">
<soapenv:Header/>
<soapenv:Body>
<tem:ZV37sdSalesorderSimulateM>
<tem:paramAppel>
<wcf:titi>2</wcf:titi>
<wcf:toto>4</wcf:toto>
</tem:paramAppel>
</tem:ZV37sdSalesorderSimulateM>
</soapenv:Body>
</soapenv:Envelope> |
Cela fonctionne parfaitement
Je n'y connais rien en xml / soap / web service :oops::calim2:
Mais j'aimerais savoir si la désignation formelle du paramètre est vraiment obligatoire ou si y'a moyen de passer l'objet en paramètre tel que.
J'arrive a passer un objet en retour de fonction et tout se passe bien pourtant...
Forcément, j'ai un n+1 qui 'pense' savoir que ca doit être possible :roll: mais plus je creuse et plus j'en doute
Alors a votre bon coeur m'sieurs dames :P , si quelqu'un a une réponse a fournir je prends :P
Merci