Hi Hari,
Thanks for your response,
my main event code is as the following :
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Security;
using Microsoft.Web.Services2.Security.Tokens;
using Microsoft.Web.Services2;
using Microsoft.Web.Services2.Security;
using Microsoft.Web.Services2.Security.X509;
using System.Web.Services.Protocols;
namespace BSSV5
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback (Certificates.ValidateRemoteCertificate);
}
protected void Button1_Click(object sender, EventArgs e)
{
WebReference.GeneralLedgerManagerService abm = new WebReference.GeneralLedgerManagerService();
string username = "JDE";
string password = "JDE";
UsernameToken ut = new UsernameToken(username, password, PasswordOption.SendPlainText);
//Create Security token...
abm.RequestSoapContext.Security.Tokens.Add(ut);
WebReference.addF0911Z1 a = new WebReference.addF0911Z1();
a.acctNoInputMode = "?";
a.amountField = 100;
a.billCode = "?";
a.company = "0002";
a.currencyCodeFrom = "?";
a.currencyConverRateOv = 1;
DateTime d = DateTime.Today;
a.dateForGLandVoucherJULIA = d.Date;
a.dateServiceCurrency = d.Date;
a.ediBatchNumber = "12312";
a.ediLineNumber = 1;
a.ediTransactNumber = "99992";
a.ediUserId = "JDE";
a.ledgerType = "?";
a.nameAlphaExplanation = "?";
a.nameRemarkExplanation = "?";
a.reference2 = "?";
a.subledger = "?";
a.subledgerType = "?";
a.unitOfMeasure = "?";
a.units = 1;
WebReference.addF0911Z1Output output = new WebReference.addF0911Z1Output();
output = abm.AddF0911Z1(a);
System.Console.WriteLine("The EchoService output is '" + output + "'");
System.Console.ReadLine();
}
}
}
after run my app a "Null pointer Exception" appears like this:
then i have edit my code like this:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Security;
using Microsoft.Web.Services2.Security.Tokens;
using Microsoft.Web.Services2;
using Microsoft.Web.Services2.Security;
using Microsoft.Web.Services2.Security.X509;
using System.Web.Services.Protocols;
namespace BSSV5
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback (Certificates.ValidateRemoteCertificate);
}
protected void Button1_Click(object sender, EventArgs e)
{
WebReference.GeneralLedgerManagerService abm = new WebReference.GeneralLedgerManagerService();
System.Net.CredentialCache myCredentials = new System.Net.CredentialCache();
NetworkCredential netCred = new NetworkCredential("JDE", "JDE");
myCredentials.Add(new Uri(abm.Url), "Basic", netCred);
abm.Credentials = myCredentials;
// string username = "JDE";
// string password = "JDE";
//UsernameToken ut = new UsernameToken(username, password, PasswordOption.SendPlainText);
// //Create Security token...
// abm.RequestSoapContext.Security.Tokens.Add(ut);
WebReference.addF0911Z1 a = new WebReference.addF0911Z1();
a.acctNoInputMode = "?";
a.amountField = 100;
a.billCode = "?";
a.company = "0002";
a.currencyCodeFrom = "?";
a.currencyConverRateOv = 1;
DateTime d = DateTime.Today;
a.dateForGLandVoucherJULIA = d.Date;
a.dateServiceCurrency = d.Date;
a.ediBatchNumber = "12312";
a.ediLineNumber = 1;
a.ediTransactNumber = "99992";
a.ediUserId = "SMASHAQBAH";
a.ledgerType = "?";
a.nameAlphaExplanation = "?";
a.nameRemarkExplanation = "?";
a.reference2 = "?";
a.subledger = "?";
a.subledgerType = "?";
a.unitOfMeasure = "?";
a.units = 1;
WebReference.addF0911Z1Output output = new WebReference.addF0911Z1Output();
output = abm.AddF0911Z1(a);
System.Console.WriteLine("The EchoService output is '" + output + "'");
System.Console.ReadLine();
}
}
}
the Error change but with this message :
Please advice me , what is the problem here??
Thanks and Best Regards,
Sarah