0

All,

I am completely new to SPML or webserivces. I know there a lot of questions regarding this issue. I have tried everything I could find. But, I guess my issues is not knowing how to format the request.

  protected void Page_Load(object sender, EventArgs e)
    {

        AddRequestType addreq = new AddRequestType();
        addreq.executionMode = ExecutionModeType.asynchronous;
        addreq.returnData = ReturnDataType.identifier;
        identity ident = new identity();
        ident.username = new string[] { "jsmith" };

        X509Store store = new X509Store(StoreName.TrustedPublisher, StoreLocation.LocalMachine);
        store.Open(OpenFlags.ReadOnly);
        var cert = store.Certificates;

        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;

        SPMLService client = new SPMLService();
        client.UseDefaultCredentials = true;

        var res = client.SPMLAddRequest(addreq);

        AddResponseType addresp = new AddResponseType();
        //addresp.requestID={ requestID};
        var status = addresp.status;
        var error = addresp.error;
        var error_msg = addresp.errorMessage;
    }

I have a certificate on the computer and I am able to read the certificate. Any guidance on how to create a SMPL request is greatly appreciated.

satishvad
  • 11
  • 6
  • What happens if you open that service in a browser, over HTTPS? Are you getting a valid certificate back, is the bar turning green? In Chrome, hit F12 -> Security and check what TLS protocol version is negotiated (e.g. TLS 1.2). You mention _"i have a certificate"_, are you trying to present a client certificate to the remote server? – evilSnobu Aug 07 '17 at 17:16
  • I just edited the code. I have a certificate installed on the computer and the above tries to read the certificate installed. – satishvad Aug 07 '17 at 17:26
  • `SPMLService client` should have a method or property to include the `cert` with the request. Or maybe `client.SPMLAddRequest(addreq);` has an overload that does that. Also, you should really narrow down that TLS version, it's important, you can't just wing it. `var cert = store.Certificates;` - that's not gonna work - see an example here: https://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/ – evilSnobu Aug 07 '17 at 17:28
  • @evilSnobu let me take a look at that. Will revert back. thank you! – satishvad Aug 07 '17 at 17:45

0 Answers0