cancel
Showing results for 
Search instead for 
Did you mean: 

Gateway service works in SAP GUI gateway client but not in SAP UI5 model

christoph_nagl
Participant
0 Kudos

HI Experts,

I have created a gateway service and when I test the service in the gateway client in SAP gui it works fine.

But when I try to create omodel, no bindings are available...

var oModel = new sap.ui.model.odata.ODataModel(

  "/sap/opu/odata/XXX_srv");

In the javascript debugger there are no bindings...

Thanks for your support.

Best regards,

Christoph

Accepted Solutions (0)

Answers (2)

Answers (2)

pfefferf
Active Contributor
0 Kudos

Ok, did you check if the service works if you call it directly in the browser ("http://<server>:<port>/<path to service>")? If that works, than the relative path should be ok, if you have deployed the UI5 app to the ABAP UI5 repository (BSP app ;-)).

christoph_nagl
Participant
0 Kudos

Hi Florian,

when I call the URL in the browser it's also working - but no bindings in the omodel...

I will try to create test service in Z-space and not in the customer space...

Christoph

pfefferf
Active Contributor
0 Kudos

Hi Christoph,

the customer namespace is just a part of the path. So if you would have a service called /abc/test_service, than the service should be available as /sap/opu/odata/abc/test_service. You can see that also in transaction SICF.

So from the information I have I would assume that it should work. To which controls you bound the data from the model, so that you have seen that there is "no binding"?

Regards,

Florian

christoph_nagl
Participant
0 Kudos

Hi,

unfortunately also Z-service is not working.

Maybe the method where I call the model instance is not correct?

I implemented the creation of the model in the controller method "onAfterRendering".

Best regards,

Christoph

jmoors
Active Contributor
0 Kudos

Are you running the SAPUI5 code and the odata from the server? It could be that you have a same origin (cross domain) issue?

http://scn.sap.com/community/developer-center/front-end/blog/2013/06/29/solving-same-origin-policy-i...

Regards,

Jason


christoph_nagl
Participant
0 Kudos

HI all,

yes I published application to the ABAP backend system (I know the problem with the cross domain locally on the tomcat).

Mhmmm...

Best,

Christoph

christoph_nagl
Participant
0 Kudos

Hi all,

ok after the call of:

sap.ui.getCore().setModel(oModel) - the binding is visible.

But the value is not set correct..

I set the binding to the Numeric Content:

<NumericContent xmlns="sap.suite.ui.commons"

  size="Auto" value="{/MAINSet('1')/PROP_NAME}"

  scale="" valueColor="Neutral" indicator="" state="Loaded"

  animateTextChange="true" formatterValue="false"

  truncateValueTo="4" icon="" press="">

  </NumericContent>

Best,

Christoph

christoph_nagl
Participant
0 Kudos

Hi Experts,

it looks for me that binding in model is correct but the values are not printed...

Best regards,

Christoph

pfefferf
Active Contributor
0 Kudos

Hi Christoph,

the problem is that you cannot bind the single record of the collection to the numeric content.

Following a little example I created yesterday which displays a numeric information via numeric content by using a JSONModel which is filled by oDataModel.read.

Controller

  onInit: function() {

    var oDataModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V2/OData/OData.svc", true);   

    oDataModel.read("/Products(1)",

           null,

           null,

           true,

             this.modelReadSuccess

    );     

  },

 

  modelReadSuccess: function(oResult, response){

  var oJSONModel = new sap.ui.model.json.JSONModel(oResult);   

  sap.ui.getCore().setModel(oJSONModel); 

  },

View (as in your example, just changed the value information)

<content>
<NumericContent xmlns="sap.suite.ui.commons"
size="Auto" value="{/Rating}"
scale="" valueColor="Neutral" indicator="" state="Loaded"
animateTextChange="true" formatterValue="false"
truncateValueTo="4" icon="" press="">
</NumericContent>
</content>

The service I used is a well known free example. But if you try it with the service, please consider to disable web-security if you are using chrome.

Regards,

Florian

pfefferf
Active Contributor
0 Kudos

Hi Christoph,

is your path correct? By default the services are located in "/sap/opu/odata/sap/XXX_srv".

Regards,

Florian

christoph_nagl
Participant
0 Kudos

Hi Florian,

yes path is correct. It's in customer specific name space...

I copied path from gateway client where I tested service!

Christoph

christoph_nagl
Participant
0 Kudos

Hi Florian,

maybe there is some customer specific configuration necessary that customer specific gateway services are working?

var oModel = new sap.ui.model.odata.ODataModel(

  "/sap/opu/odata/CUSTOMER_XXX/SERVICE_XXX_srv");

Thanks for your support!

Best regards,

Christoph