0

I want to consume a saop request in react native. But the problem is in self-signed ssl certificate on the backend. So the question. Is there any way to skip this validation certificate?

I use this code :

xmlhttp = new XMLHttpRequest();
            xmlhttp.open('POST', 'https://xxx.xxx.xxx.xxx:1443/orawsv/user/WSS_USER_LOGIN/GETLOGIN', true);

            // build SOAP request
            sr =
                '<?xml version="1.0" encoding="utf-8"?>' +
                '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"'+
                ' xmlns:get="http://xmlns.oracle.com/orawsv/user/WSS_USER_LOGIN/GETLOGIN">'+
                ' <soapenv:Header/>'+
                '   <soapenv:Body>'+
                    '<soapenv:Body>' +
                        '<get:CGETLOGIN_OUT-GETLOGINInput>'+
         '<get:SQLMSGIN-GETLOGIN_IN-CIN>'+
          '  <get:GETLOGIN_IN>'+
          '     <get:LOGIN>login</get:LOGIN>'+
            '   <get:PASSWORD>password</get:PASSWORD>'+
          '  </get:GETLOGIN_IN>'+
         '</get:SQLMSGIN-GETLOGIN_IN-CIN>'+
      '</get:CGETLOGIN_OUT-GETLOGINInput>'+
                    '</soapenv:Body>' +
                '</soapenv:Envelope>';

            xmlhttp.onreadystatechange = function () {

                              console.log(xmlhttp.responseText);
                if (xmlhttp.readyState == 4) {
                    if (xmlhttp.status == 200) {
                        console.log('done. use console to see network response');
                          console.log(xmlhttp.responseText);
                    }
                }
            }
            xmlhttp.setRequestHeader('Content-Type', 'text/xml');
            xmlhttp.send(sr);
            console.log('send');
        }

And the complete error is:

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

user3884677
  • 413
  • 5
  • 26
  • 1
    "*Is there any way to skip this validation certificate?*" skipping certificates validation is not a good idea, and certainly not the path to follow. Have a look at https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf – Patrick Mevzek Jul 30 '18 at 15:20
  • Thanks for this informations. I recovered the .crt certificate. however, this one is not certified by an organization. How can I configure my webservice to use this certificate? – user3884677 Jul 31 '18 at 07:46
  • Which library should I use to consume soap requests? Should I eject my app? Someone can help me? – user3884677 Jul 31 '18 at 15:39
  • 1
    There are many questions about javascript and SOAP, here is one: https://stackoverflow.com/questions/124269/simplest-soap-example. SOAP is complicated, and this is orthogonal to certificates management, so I advise indeed to use a library for it and not to generate XML frames by hand, as you will hit many problems. – Patrick Mevzek Jul 31 '18 at 15:48
  • actually, many talk about javascript and saop. But I don't find any concerning the SSL certificate. What librairy do you advise me? – user3884677 Jul 31 '18 at 16:05
  • I see, I can use fetch or jquery library to use soap request. But somebody can help me concerning the SSL certificate? I don't find the solution. – user3884677 Aug 02 '18 at 07:43
  • I found this librairy https://github.com/localz/react-native-pinch that could be a solution. But when I try to use it I have this error: "undefined is not an object (evaluating '_reactNative.NativeModules.RNPinch.fetch') fetch" – user3884677 Aug 06 '18 at 09:01
  • Any update here. Any one suggest how to call SOAP web service in React native. Any sample or library? – rams Oct 29 '18 at 12:52

0 Answers0