Consume Https BSSV with .Net

SarahMQ

Member
Dear All,


i need your help in my problem with a custom BSSV that i have created as the steps in the document http://www.oracle.com/technetwork/to...ice-131800.pdf
after the BSSV deployed by a package to the web logic 10.3.5.
the BSSV is secured by a self signed certificate created with keytool .

i have the WSDL HTTPS URL and its opened , then i test it using SOAPUI and its successfully consumed after i have add the credentials (My JDE username and Password) in the SOAP header,
then i am trying to call this BSSV by a .Net web application as the steps in the document :http://www.jdelist.com/w3tfiles/1438...%20Clients.pdf
but the Error "Soap header exception" appears as follow :


Call BSSV in .net.jpg

please advice me about this error , i cannot find any result about this problem .

Thanks and Regards,
Sarah
 
Last edited by a moderator:
Thanks for your response , am using visual studio 2008 but I set the .net frame work of the project to 2.0 in order to use the webservice2 dll
 
Hi Sarah,

Does your code work with plain http? If so, try this:

Add this line of code to accept all SSL certificates (you an change this to just your certificate by researching it further):

System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);

On a side note: You should not have to set the framework to .Net 2.0 to use 4.0 (unless it is a 32-bit dll, and there are workarounds for that as well).
 
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:
null pointer error in .net.jpg

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 :
Call BSSV in .net.jpg

Please advice me , what is the problem here??
Thanks and Best Regards,
Sarah
 
Sarah,

The first part of your code (before you made changes) that has this should be correct (to my knowledge, I don't work with BSSVs as most of the work I do is in .NET. May be someone here can confirm this?)

abm.RequestSoapContext.Security.Tokens.Add(ut);

In the changed part, you are using Basic authentication to send your credentials. I don't think BSSV supports this method (again, please confirm this with someone else).

The null pointer exception is being raised on the BSSV side. You should check your BSSV logs to troubleshoot this.
 
Back
Top