Webservice in C # Reading Xml

0
Good afternoon, I'm building a WebService in C #, I created a method that reads an XML sent as a request and should return the student's name ... The problem I'm facing is actually when I try to perform the test using SoapUI, when I send the XML I have an empty response with the HTTP / 1.1 400 Bad Request error.

I would like help solving this problem, as I do not know how to solve it ...

Here is the code for my used classes:

My webservice method:

[WebMethod]
    public String CapturarDados(String Xml) {

        String retorno = "teste";

        try
        {
            LeitorXml p = new LeitorXml();

            retorno = p.LerXml(Xml);
        }
        catch (Exception ex )
        {

            retorno = ex.Message;
        }

        return retorno;
    }

ReaderXml Class:

public class LeitorXml
{
    public String LerXml(String xml)
    {

        XmlDocument xDoc = new XmlDocument();
        xDoc.LoadXml(xml);
        XmlNodeList xnList = xDoc.GetElementsByTagName("Alunos");

        string sNome = xnList[0]["nome"].InnerXml;

        String retorno = sNome;



        System.IO.StreamWriter file = new System.IO.StreamWriter("c:\test.txt");
        file.WriteLine(sNome);

        file.Close();

        return retorno;
    }
}

Input XML:

  <Alunos>
           <nome>Caio</nome>
           <idade>21</idade>
           <email>[email protected]</email>
           <Endereco>
              <Rua>Av.Lins de Vasconcelos</Rua>
              <Bairro>Cambuci</Bairro>
              <Cidade>São Paulo</Cidade>
              <Estado>SP</Estado>
              <Cep>16520-005</Cep>
           </Endereco>
        </Alunos>

Using visual studio the answer is OK.

ButwhenusingSoapUIthisistheproblempresented:

    
asked by anonymous 09.09.2015 / 20:41

0 answers