I need to do a POST to a web service and I can not find the return.
I managed to make the request from the SoapUI app, but when I take that to the ASPNET MVC code in C # I always get the error: "The requested URL was rejected"
Basically I do not know where to configure the security data (username, password and password type, in this case PASSWORDTEXT).
Will you have an example?
I leave what I have armed that I managed to rescue from other examples on the web:
[TestMethod]
public void TestWSFalabella()
{
var _url = "url";
var _action = "";
XmlDocument soapEnvelopeXml = CreateSoapEnvelope();
HttpWebRequest webRequest = CreateWebRequest(_url, _action);
string auth = string.Format("Basic {0}", Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(string.Format("{0}:{1}", "usuario", "password"))));
webRequest.PreAuthenticate = true;
webRequest.Headers.Add(HttpRequestHeader.Authorization, auth);
webRequest.UseDefaultCredentials = false;
InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest);
// begin async call to web request.
IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null);
// suspend this thread until call is complete. You might want to
// do something usefull here like update your UI.
asyncResult.AsyncWaitHandle.WaitOne();
// get the response from the completed web request.
string soapResult;
using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult))
{
using (StreamReader rd = new StreamReader(webResponse.GetResponseStream()))
{
soapResult = rd.ReadToEnd();
}
Console.Write(soapResult);
}
}