Not able to pass root certificate while calling soap service

Viewed 64

When I try to call SOAP service from SOAP UI, Root certificate is being passed, while calling from SOAPClient Root certificate is not being passed, Can anyone suggest how to forcefully add root Certificate while making SOAP request. Below is the code I am using


    public void InvokeProxy()
            {
              
                var client = new ServiceSoapClient();
                client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindByIssuerName, "ABC");
                System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
                var response = string.Empty;
                var cred = new WebApplication14.Services.MessageCredentials();
                cred.UId = "XXXXXXX";
                cred.UPwd = "XXXXXXX";
                var message = new Services.Message();
                message.C = cred;
                string reqBody = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:crif-message:2006-08-23' xmlns:urn1='urn:crif-messagegateway:2006-08-23'>" +
                              "<soapenv:Header>" +
                              "<urn:Message GId='' MId='' MTs='2017-06-05T15:36:56.7577435 + 04:00'>" +
                              "<urn:C UD='' UId='xxxxx' UPwd='xxxxxx'></urn:C>" +
                              "<urn:P SId='CB' PId='NAE' PNs='urn:uae-message:2014-06-01'></urn:P>" +
                              "<urn:Tx TxNs='urn:crif-messagegateway:2006-08-23'></urn:Tx></urn:Message></soapenv:Header>" +
                              "<soapenv:Body><urn1:MGRequest>" +
                              "<![CDATA[<?xml version='1.0' encoding='UTF - 8'?><!--Sample XML file generated by XMLSpy v2017 rel. 3 sp1 (x64) (http://www.altova.com)--><u3:NAE_REQ xmlns:u3='urn: NAE' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='urn:NAE NAE_REQ.xsd'><u3:ConsentFlag>1</u3:ConsentFlag><u3:Application><u3:ProviderApplicationNo>CHNG03-APP</u3:ProviderApplicationNo><u3:ContractType>103</u3:ContractType><u3:NotInstallment><u3:CreditLimit></u3:CreditLimit></u3:NotInstallment></u3:Application><u3:Role>A</u3:Role><u3:Subject><u3:ProviderSubjectNo></u3:ProviderSubjectNo><u3:Company><u3:TradeName>xxxxx</u3:TradeName><u3:TradeLicense><u3:RegistrationPlace>18</u3:RegistrationPlace><u3:Number>sssss</u3:Number></u3:TradeLicense><u3:EconomicActivity></u3:EconomicActivity><u3:PrimaryMobileNo>0000000000</u3:PrimaryMobileNo></u3:Company></u3:Subject></u3:NAE_REQ>]]>" +
                              "</urn1:MGRequest></soapenv:Body></soapenv:Envelope>";
                try
                {
                    var svc = client.ProcessMessage(message, reqBody, out response);
                }
                catch (FaultException fex)
                {
                    throw fex;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

below is the traffic from wireshark [![enter image description here][1]][1]

As it can be seen 2 certificates are being passed. while below image is while calling from SOAP UI [![enter image description here][2]][2]

Can anyone suggest please, how can I forcefully add root CA. Thanks [1]: https://i.stack.imgur.com/7YnTw.jpg [2]: https://i.stack.imgur.com/lTsKj.jpg

0 Answers
Related