mpatel
mpatel

Reputation: 19

Authentication Failure: SOAP body must be signed for signature-based authentication. No credentials were provided. Contact IT SOASvsSupport

I tried to bind x509 certificate and send data via client's webservice. I created a window form application and use Microsoft.web.Service3, but when I run this win app on my local it gives me an error like:

Authentication Failure: SOAP body must be signed for signature-based authentication. No credentials were provided. Contact IT SOASvsSupport.

Can anyone help here?

private void btnSubmit_Click(object sender, EventArgs e) { string certificateFile = @"C:\XYZ\MyTest.cer";

        System.Security.Cryptography.X509Certificates.X509Certificate x509Certificate = new System.Security.Cryptography.X509Certificates.X509Certificate(certificateFile);
        //X509Certificate x509Certificate = X509Certificate.CreateFromCertFile(certificateFile);
        MyTest.DataService rdf = new MyTest.DataService();
        RvsDataFeed[] rvs = rdf.GetRvsDataFeed();
        txtXml.Text = "";

        if (rvs != null)
        {
            foreach (RvsDataFeed rvsdata in rvs)
            {

                try
                {

                    TrackingRequest wbttreq = new TrackingRequest();
                    ClientType cit = new ClientType();


                    cit.requestorAppName = "MMM";
                    cit.requestorUserName = rvsdata.ID;
                    wbttreq.ClientInfo = cit;


                    ClientWSDL.DataUtility xyzWSDL = new ClinetWSDL.DataUtility();
                    xyzWSDL.Url = "http://xyz.xy";

                    xyzWSDL.ClientCertificates.Add(x509Certificate);

                    txtXml.Text = txtXml.Text + Environment.NewLine + SerializeToString(td);

                    TrackingResponse res = new TrackingResponse();
                    xyzWSDL.WriteBack(wbttreq);

                    rdf.LogRvsDataFeedSent(rvsdata.DataFeedID);

                }
                catch (Exception ex)
                {
                    txtXml.Text = txtXml.Text + Environment.NewLine + ex.Message;
                }


            }
        }

    }

Upvotes: 0

Views: 738

Answers (1)

mpatel
mpatel

Reputation: 19

private void btnSubmit_Click(object sender, EventArgs e) { string certificateFile = @"C:\XYZ\MyTest.cer";

        System.Security.Cryptography.X509Certificates.X509Certificate x509Certificate = new System.Security.Cryptography.X509Certificates.X509Certificate(certificateFile);
        //X509Certificate x509Certificate = X509Certificate.CreateFromCertFile(certificateFile);
        MyTest.DataService rdf = new MyTest.DataService();
        RvsDataFeed[] rvs = rdf.GetRvsDataFeed();
        txtXml.Text = "";

        if (rvs != null)
        {
            foreach (RvsDataFeed rvsdata in rvs)
            {

                try
                {

                    TrackingRequest wbttreq = new TrackingRequest();
                    ClientType cit = new ClientType();


                    cit.requestorAppName = "MMM";
                    cit.requestorUserName = rvsdata.ID;
                    wbttreq.ClientInfo = cit;


                    ClientWSDL.DataUtility xyzWSDL = new ClinetWSDL.DataUtility();
                    xyzWSDL.Url = "http://xyz.xy";

                    xyzWSDL.ClientCertificates.Add(x509Certificate);

                    txtXml.Text = txtXml.Text + Environment.NewLine + SerializeToString(td);

                    TrackingResponse res = new TrackingResponse();
                    xyzWSDL.WriteBack(wbttreq);

                    rdf.LogRvsDataFeedSent(rvsdata.DataFeedID);

                }
                catch (Exception ex)
                {
                    txtXml.Text = txtXml.Text + Environment.NewLine + ex.Message;
                }


            }
        }

    }

Upvotes: 0

Related Questions