eba
eba

Reputation: 673

Webservice call web method

i have webservice with one method which recieves xml as string:

[WebMethod]
public int Catch_string(string str)
{  
}

how can i send xml file to this method from win forms?

why doesn't it work^

HttpWebRequest req = 
(HttpWebRequest)WebRequest.Create("http://localhost/test/service.asmx");
       req.ContentType = "text/xml;charset=\"utf-8\"";
       req.Accept = "text/xml";
       req.Method = "POST";
       Stream stm = req.GetRequestStream();
       outXml.Save(stm);
       stm.Close();

Upvotes: 2

Views: 4759

Answers (1)

Vinay B R
Vinay B R

Reputation: 8421

Add a webreference to your winforms application and use the generated proxy class to invoke the webservice.

Checkout this link for implementation details.

Upvotes: 4

Related Questions