I have a web service in SAP and I have to make a C# client to the web service. I create the client but I receive an error from C#
. Error is this :
Object reference not set to an instance of an object.
My source for client is this:
Uri uri = new Uri("http://address");
var address = new EndpointAddress(uri, EndpointIdentity.CreateSpnIdentity("teste"));
ServiceReference2.ZWS_PEP_ENVIO_MRZClient wsclient = new ServiceReference2.ZWS_PEP_ENVIO_MRZClient();
// wsclient.Endpoint.Binding.Scheme;
wsclient.ClientCredentials.UserName.UserName = "user_name";
wsclient.ClientCredentials.UserName.Password = "password";
wsclient.Endpoint.Address = address;
wsclient.Open();
ServiceReference2.ZwsPepEnvioMrz request = new ServiceReference2.ZwsPepEnvioMrz();
request.Descricao = descricaoField;
request.Mrz1 = mrz1Field;
request.Mrz2 = mrz2Field;
request.Numeroprocesso = numeroprocessoField;
request.Sn = snField;
request.Statusdatapreparation = statusdatapreparationField;
request.Versaodocumento = versaodocumentoField;
wsclient.ZwsPepEnvioMrz(request);
ServiceReference2.ZwsPepEnvioMrzResponse1 response = new ServiceReference2.ZwsPepEnvioMrzResponse1();
Resultado = response.ZwsPepEnvioMrzResponse.ToString();
textBox1.Text = Resultado;
wsclient.Close();
And the program terminates at
Resultado= response.ZwsPepEnvioMrzResponse.ToString()
Any ideas why?