SOLVED with this link
I'm developing a wcf service, with rest pattern. Now it is on a IIS server.
It has got a method callable with a post, which has to receive a xml data.
I'm trying to send this xml (with other parameter), but I'm getting only deserial errors:
in System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
in System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)
in System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)
in System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
in System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
in System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
in System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
in System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
This is the request:
retista=0019&hashedStrig=dkfjdkfjd&dati=<ArrayOfWrapClienti xmlns="http://schemas.datacontract.org/2004/07/MultipayOnline" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><WrapClienti><CODRETE>0018</CODRETE><CODICE>20685</CODICE><NOME>A.T.E.R. Azienda Territoriale</NOME><INDIRIZZO>PIAZZA POZZA</INDIRIZZO><CITTA>Verona</CITTA><CAP>37123</CAP><PROV>VR</PROV><CODICEFISCALE>00223640236</CODICEFISCALE><PIVA>223640236</PIVA><EMAIL/><ESPOSIZ_CONTABILE>937,02</ESPOSIZ_CONTABILE><STATO>FALSE</STATO></WrapClienti></ArrayOfWrapClienti>
and this is the xml I'm trying to send:
<ArrayOfWrapClienti xmlns="http://schemas.datacontract.org/2004/07/aaa" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<WrapClienti>
<CODRETE>1111</CODRETE>
<CODICE>111</CODICE>
<NOME>AAA</NOME>
<INDIRIZZO>PIAZZA</INDIRIZZO>
<CITTA>AAA</CITTA>
<CAP>111</CAP>
<PROV>aa</PROV>
<CODICEFISCALE>111</CODICEFISCALE>
<PIVA>223611140236</PIVA>
<EMAIL/>
<ESPOSIZ_CONTABILE>1111</ESPOSIZ_CONTABILE>
<STATO>FALSE</STATO>
</WrapClienti>
</ArrayOfWrapClienti>
If you click here, you can find out how an xml is returned by my wcf. I thought I have to send the same xml with other data, but I get the deserial error.
Why?
How can I send the xml to my wcf? In this test phase, I'm using this.
If I can give to you other useful infos, ask me and I'll write them here.
UPDATE: The text of the error message says that there are invalid data at root level, row 1, pos 1. Also if I put
<?xml version="1.0" encoding="utf-8" ?>
at the root level.
Maybe are there some missing headers?
UPDATE server side:
this is how my server wcf is configured:
[OperationContract]
[WebGet(UriTemplate = "cliente.xml?retista={codret}&cliente={codiceCliente}&H={hashedString}", ResponseFormat = WebMessageFormat.Xml)]
List<WrapClienti> GetClienteXML(string codret, string codiceCliente, string hashedString);
and this is the called method:
public GenericResponse SetClientiXML(List<WrapClienti> clienti, string retista, string hashedString)
{
var api = new API();
return api.SetClienti(clienti, retista, hashedString);
}
as you can I see, I don't manage any xml/json deserialzing phase, it is managed by the wcf routine. For example, if I send a json list, it converts it to a List. This is what also with xml I want to see, but I'm getting the error at the top of this question.
ANOTHER UPDATE: I have to send 3 parameters in xml, so.... this is my last attempt, I think it is more correct than previouses. Now the server gives null reference error:
<?xml version="1.0" encoding="utf-8" ?>
<SetClientiXML
xmlns="http://tempuri.org/">
<XMLRequest>
<ArrayOfWrapClienti
xmlns="http://schemas.datacontract.org/2004/07/aaa"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<WrapClienti>
<CODRETE>111</CODRETE>
<CODICE>111</CODICE>
<NOME>aaa</NOME>
<INDIRIZZO>aaa</INDIRIZZO>
<CITTA>aaa</CITTA>
<CAP>aaa</CAP>
<PROV>aa</PROV>
<CODICEFISCALE>111</CODICEFISCALE>
<PIVA>2236401111236</PIVA>
<EMAIL/>
<ESPOSIZ_CONTABILE>111</ESPOSIZ_CONTABILE>
<STATO>FALSE</STATO>
</WrapClienti>
</ArrayOfWrapClienti>
<RETISTA>1111</RETISTA>
<HASHEDSTRING>oklkokokokok</HASHEDSTRING>
</XMLRequest>
</SetClientiXML>
I have also created this class:
[DataContract]
public class XMLRequest
{
[DataMember]
public List<WrapClienti> XML;
[DataMember]
public string RETISTA;
[DataMember]
public string HASHEDSTRING;
public XMLRequest() { }
public XMLRequest(List<WrapClienti> x, string r, string h)
{
this.HASHEDSTRING = h;
this.XML = x;
this.RETISTA = r;
}
}
and the portotype now is:
public GenericResponse SetClientiXML(XMLRequest xr)