Quantcast
Channel: SCN : Discussion List - SAP Enterprise Portal : Administration and Development
Viewing all articles
Browse latest Browse all 2686

How to consume a WSDL

$
0
0

Hi All,

 

My scenario- I have a WSDL url from BI system, which needs to be consumed in SAPUI5 to show the output. The wsdl is authenticated by userid/pass and needs infoprovider and query name as the input (plus two more parameters which would be blank) to generate proper response.

My problem is that when I try to get the response after setting the required input parameters, it is giving me the exact same XML as the one which gets generated when I type in the WSDL url in the browser. (the one without sending any parameter)

 

The WSDL url from BI system is :

http://HOST:PORT/sap/bc/srt/rfc/sap/QUERY_VIEW_DATA?sap-client=001&wsdl=1.1&mode=sap_wsdl&style=rpc

 

Here is my exact code which I am using:

 

<code>

 

<!DOCTYPE HTML>

<html>

       <head>

              <meta http-equiv="X-UA-Compatible" content="IE=edge">

              <script src="resources/sap-ui-core.js"

                           id="sap-ui-bootstrap"

                           data-sap-ui-libs="sap.ui.commons"

                           data-sap-ui-theme="sap_goldreflection">

              </script>

 

               <script>

                           sap.ui.localResources("Test_12dec");

                           var view = sap.ui.view({id:"idDemo1", viewName:"Test_12dec.Demo", type:sap.ui.core.mvc.ViewType.JS});

                           view.placeAt("content");

              </script>

           

               <script>

              var xmlhttp = new XMLHttpRequest();

              var url ="WSDL URL";

              var params = 'Infoprovider=InfoName&Parameter=&Query=QueryName&ViewId=';

             xmlhttp.open('POST', url, true,'user','pass');

             xmlhttp.setRequestHeader("Access-Control-Allow-Origin","*");

             xmlhttp.setRequestHeader("Access-Control-Allow-Methods", "POST");

             xmlhttp.setRequestHeader('Access-Control-Allow-Headers','Origin, X-Requested-With, Content-Type, Accept');

             xmlhttp.withCredentials=true;

       

             xmlhttp.onreadystatechange = function()

                    {

                         if(xmlhttp.readyState == 4 && xmlhttp.status == 200)

                              {                alert(xmlhttp.responseText);            }

                     }

       

              xmlhttp.send(params);

         

            </script>

 

       </head>

       <body class="sapUiBody" role="application">

              <div id="content"></div>

       </body>

</html>

 

<code>

 

Please help me identifying my problem. I am not sure if the WSDL is rightly created? If I am using the right method to send the parameters into the WSDL?

I used Chrome's diable web security and when I inspect element, I can see the correct status and ready state.

 

Thanks,

Atul


Viewing all articles
Browse latest Browse all 2686

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>