formating the XML response in webservice

Discussion in 'ASP .Net Web Services' started by Draggi, Dec 27, 2005.

  1. Draggi

    Draggi Guest

    Hello,

    First, Please excuse me for my bad english.

    I developped a small webservice in C# who execute a sored procedure in a
    sql server 2005.
    Everything was OK, but our client have a problem to integrate it on java
    plateform, because the XML was formatting in microsoft standard format.

    Could you help me please, or send me a link about , how to format XML
    response, or how to include the response in a array var considering my C#
    code.

    I join my code here:

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web.Services;
    [WebService(Namespace = "toto_CHECK")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Webservicetoto : System.Web.Services.WebService {

    public Webservicetoto () {

    }

    [WebMethod]
    public DataSet Get_status_for_pitchs_and_location(int id_camp)
    {

    SqlConnection myConnection = new
    SqlConnection("server=localhost;uid=***;pwd=******;database=****;");
    SqlDataAdapter myCommand1 = new SqlDataAdapter("EXECUTE
    CHECK_HEB_FOR_toto " + id_camp, myConnection);

    DataSet ds = new DataSet();
    myCommand1.Fill(ds);
    return ds;
    }
    }
     
    Draggi, Dec 27, 2005
    #1
    1. Advertisements

  2. Draggi

    Draggi Guest

    For someone who have the same problem this is the solution :
    > using System;
    > using System.Data;
    > using System.Data.SqlClient;
    > using System.Web.Services;

    using System.Xml;
    > [WebService(Namespace = "toto_CHECK")]
    > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    > public class Webservicetoto : System.Web.Services.WebService {
    >
    > public Webservicetoto () {
    >
    > }
    >
    > [WebMethod]
    > public XmlDocument Get_status(int id_camp)
    > {
    >
    > SqlConnection myConnection = new
    > SqlConnection("server=localhost;uid=***;pwd=******;database=****;");
    > SqlDataAdapter myCommand1 = new SqlDataAdapter("EXECUTE
    > CHECK_HEB_FOR_toto " + id_camp, myConnection);
    >
    > DataSet ds = new DataSet();
    > myCommand1.Fill(ds);


    XmlDataDocument dataDoc = new XmlDataDocument(ds);
    return dataDoc;

    > }
    > }
    >
    >
     
    Draggi, Dec 29, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Turner
    Replies:
    2
    Views:
    9,890
    Ken Cox [Microsoft MVP]
    Jan 2, 2004
  2. David

    Write XML with formating

    David, Mar 6, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    444
    Matt Berther
    Mar 6, 2005
  3. batista
    Replies:
    1
    Views:
    1,115
    Laurent Bugnion
    Jan 26, 2006
  4. batista
    Replies:
    0
    Views:
    710
    batista
    Jan 26, 2006
  5. Magnus Lindberg

    Changing xml-encoding for webservice response

    Magnus Lindberg, May 4, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    606
    Dino Chiesa [Microsoft]
    May 5, 2004
  6. Jurjen de Groot

    xml error in webservice SOAP response ?

    Jurjen de Groot, Dec 29, 2007, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    353
    Jurjen de Groot
    Jan 4, 2008
  7. Rich Fowler
    Replies:
    2
    Views:
    2,221
    Rich Fowler
    Jan 22, 2010
  8. Erik Wasser
    Replies:
    5
    Views:
    817
    Peter J. Holzer
    Mar 5, 2006
Loading...