Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2161

Re: How to access a SOAP service in HCP via HTTP

$
0
0

Hi Jamie,

 

I am not able to attach entire project so adding the file code.

 

 

Index.html

 

<!DOCTYPE HTML>

<html>

    <head>

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

        <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

        <title>VCS</title>

        <script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"

                id="sap-ui-bootstrap"

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

                data-sap-ui-theme="sap_bluecrystal"

                data-sap-ui-xx-bindingSyntax="complex"

            data-sap-ui-resourceroots='{"com.company.vcs": "./"

            }'>

        </script>

        <link rel="stylesheet" type="text/css" href="css/fullScreenStyles.css">

 

        <script>

            sap.ui.getCore().attachInit(function() {

                new sap.m.Shell({

                    app: new sap.ui.core.ComponentContainer({

                        height : "100%",

                        name : "com.company.vcs"

                    })

                }).placeAt("content");

            });

        </script>

     

    </head>

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

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

    </body>

</html>

 

Component.js

 

jQuery.sap.declare("com.company.vcs.Component");

sap.ui.core.UIComponent.extend("com.company.vcs.Component", {

    metadata : {

        routing : {

            config : {

                viewType : "JS",

                viewPath : "com.company.vcs.view",

                targetControl : "navContainer",

                targetAggregation : "pages",

                clearTarget : false

            },

            routes : [ {

                viewType : "XML",

                pattern : "",

                name : "geoCrew",

                view : "geoCrew"

            } ]

        }

    }

});

com.company.vcs.Component.prototype.init = function() {

    jQuery.sap.require("sap.m.routing.RouteMatchedHandler");

    jQuery.sap.require("com.company.vcs.MyRouter");

    jQuery.sap.require("sap.ui.core.routing.Router");

    jQuery.sap.require("sap.ui.core.routing.History");

 

    sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

 

    var router = this.getRouter();

 

    router.myNavBack = com.company.vcs.MyRouter.myNavBack;

    router.myNavToWithoutHash = com.company.vcs.MyRouter.myNavToWithoutHash;

    this.routeHandler = new sap.m.routing.RouteMatchedHandler(router);

    router.initialize();

};

 

com.company.vcs.Component.prototype.destroy = function() {

    if (this.routeHandler) {

        this.routeHandler.destroy();

    }

    sap.ui.core.UIComponent.destroy.apply(this, arguments);

};

 

com.company.vcs.Component.prototype.createContent = function() {

    this.view = sap.ui.view({

        id : "app",

        viewName : "com.company.vcs.view.App",

        type : sap.ui.core.mvc.ViewType.XML

    });

 

    var deviceModel = new sap.ui.model.json.JSONModel({

        isTouch : sap.ui.Device.support.touch,

        isPhone : sap.ui.Device.system.phone,

        isNoPhone : !jQuery.device.is.phone,

        listMode : sap.ui.Device.system.phone ? "None" : "SingleSelectMaster",

        listItemType : sap.ui.Device.system.phone ? "Active" : "Inactive"

    });

 

    deviceModel.setDefaultBindingMode("OneWay");

    this.view.setModel(deviceModel, "device");

 

    return this.view;

};

 

 

neo-app.json

 

{

    "welcomeFile": "index.html",

    "routes": [

    {

        "path": "/WeatherWS",

        "target": {

            "type": "destination",

            "name": "WeatherWSDL"

        },

    "description": "WeatherWSDL"

    }

    ]

}

 

App.view.xml

 

<mvc:View controllerName="com.company.vcs.view.App" xmlns:mvc="sap.ui.core.mvc"

    displayBlock="true" xmlns="sap.m">

    <App id="navContainer" />

</mvc:View>

 

App.controller.js

 

sap.ui.core.mvc.Controller.extend("com.company.vcs.view.App", {

 

});

 

geoCrew.view.xml

 

<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"

    xmlns:commons="sap.ui.commons" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout"

    xmlns:vbm="sap.ui.vbm" controllerName="com.company.vcs.view.geoCrew"

    height="100%" displayBlock="true">

    <l:FixFlex class="fixFlexFixedSize">

        <l:flexContent>

            <Button text="Call Service" press="CallSOAP" type="Emphasized" />

        </l:flexContent>

    </l:FixFlex>

</mvc:View>

 

 

geoCrew.controller.js

 

jQuery.sap.require("sap.ui.Device");

sap.ui.controller("com.company.vcs.view.geoCrew", {

      

        onInit : function () {

         // set the device model

            var oDeviceModel = new sap.ui.model.json.JSONModel(sap.ui.Device);

            oDeviceModel.setDefaultBindingMode("OneWay");

            this.getView().setModel(oDeviceModel, "device");

            this.router = sap.ui.core.UIComponent.getRouterFor(this);

          this.router.attachRoutePatternMatched(this._handleRouteMatched, this);

         

        },

        _handleRouteMatched:function(){

           

        },

        CallSOAP: function(){

            var oModel2 = new sap.ui.model.xml.XMLModel();

            oModel2.loadData("/WeatherWS/Weather.asmx/GetCityForecastByZIP?ZIP=19073", null, false);

            console.log("Xml model",oModel2)

        }

     

});

 

MyRouter.js

 

jQuery.sap.declare("com.company.vcs.MyRouter");

jQuery.sap.require("sap.m.routing.RouteMatchedHandler");

jQuery.sap.require("sap.ui.core.routing.Router");

 

com.company.vcs.MyRouter =  {

 

  

    myNavBack : function (route, data) {

        var history = sap.ui.core.routing.History.getInstance();

        var url = this.getURL(route, data);

        var direction = history.getDirection(url);

        if ("Backwards" === direction) {

            window.history.go(-1);

        } else {

            var replace = true;

            this.navTo(route, data, replace);

        }  

    },

 

  

    myNavToWithoutHash : function (viewName, viewType, master, data) {

        var app = sap.ui.getCore().byId("splitApp");

        var view = this.getView(viewName, viewType);

        app.addPage(view, master);

        app.to(view.getId(), "show", data);

    }

};

 

Thanks,

Venugopal


Viewing all articles
Browse latest Browse all 2161

Trending Articles



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