Hi,
I'm having troubles consuming a webservice.
The WS that I must consume works in two fases, first I must consume a simpler one, this I manage with this code:
public String ConectaWebService(String user, String pass, String tipo, String ip)
{
var HtmlResult = "";
var token = "";
var URL = "myWebService";
var myParameters = "login=" + user + "&password=" + pass + "&tipo=" + tipo;
try
{
var wc = new WebClient();
wc.Headers["Content-type"] = "application/x-www-form-urlencoded";
HtmlResult = wc.UploadString(URL, myParameters);
var start = HtmlResult.IndexOf("<auth-token>") + 12;
var end = HtmlResult.IndexOf("</auth-token>", start);
token = HtmlResult.Substring(start, end - start);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return token;
}
This will return a XML with a token inside, this is ok too.
But after that I must consume another webservice, where I realy create the information that I want but I really didn't manage, I try several ways but nothing.
I try with HttpWebRequest, WebRequest and WebClient but without sucess.
It just didn't answer and says that the limet time is finish.
The things that I know is that is POST and the Content-type is application/x-www-form-urlencoded. I must send some parameters too, but not through the URL, It must be encoded with UTF8 and sent.
Please, can anyone help me?
Thanks a lot.
Raimundo