Newbie implementing WS, and according to our infrastructures we have to use C#, so maybe will use WCF maybe,
The thing is that our system must store some info of payments that a third company will send us
But they just give us some xml messages examples and an excel files explaining the messages as xpath format (indicating the meanings, types and if it is mandatory). Once implemented we must notified them (no even a endpoint was given y, so I suppose we have to consider it as a variable). Seems that they have their ws implemented in java.
Reviewing tutorials and books, I think they should give us a WSDL file or is it possible to implement the services with just those xml samples? and if so what should be the process? How to build the proxy?
Create another helper to create a Http POST helper to hit your third party's endpoint. The following code should atleast get you
private static string PostData(string url, string postData, string contentType, string methodType)
{
var uri = new Uri(url);
var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = methodType;
request.ContentType = contentType;
request.ContentLength = postData.Length;
using (Stream writeStream = request.GetRequestStream())
{
var encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes(postData);
writeStream.Write(bytes, 0, bytes.Length);
}
string result;
using (var response = (HttpWebResponse)request.GetResponse())
{
using (var responseStream = response.GetResponseStream() ?? new MemoryStream())
{
using (var readStream = new StreamReader(responseStream, Encoding.UTF8))
{
result = readStream.ReadToEnd();
}
}
}
return result;
}