cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming gateway service with BreezeJS

joachimvanpraet
Active Participant
0 Kudos

Hi,

I'm trying to consume a gateway service with BreezeJS.

BreezeJS is a really good javascript library for odata services, that enables you to query your gateway service.

For getting this working the service needs to fullfil some requirements.

Most requirements are not a problem for gateway, except the inverse relationsship.

I'll try to explain my problem.

I have a gateway service with an associationset which creates an association between Business Partner and sales order.

For making the Breeze library to work I need to specify the inverse relation.

To specify this inverse relation I need to change the name of the role of each endpoint.

To make it more clear I've created an example. This is how it generates on gateway:

    <AssociationSet Name="BusinessPartnerSalesOrders_AssocSet" Association="ZCODEJAM02_SRV.BusinessPartnerSalesOrders" sap:creatable="false" sap:updatable="false" sap:deletable="false"sap:content-version="1">

        <End EntitySet="BusinessPartners" Role="FromRole_BusinessPartnerSalesOrders"/>

        <End EntitySet="SalesOrders" Role="ToRole_BusinessPartnerSalesOrders"/>

    </AssociationSet>

    <AssociationSet Name="SalesOrdersBusinessPartner_AssocSet" Association="ZCODEJAM02_SRV.SalesOrdersBusinessPartner" sap:creatable="false" sap:updatable="false" sap:deletable="false"sap:content-version="1">

        <End EntitySet="SalesOrders" Role="FromRole_SalesOrdersBusinessPartner"/>

        <End EntitySet="SalesOrderItems" Role="ToRole_SalesOrdersBusinessPartner"/>

    </AssociationSet>

And this is how I want it:

    <AssociationSet Name="BusinessPartnerSalesOrders_AssocSet" Association="ZCODEJAM02_SRV.BusinessPartnerSalesOrders" sap:creatable="false" sap:updatable="false" sap:deletable="false"sap:content-version="1">

        <End EntitySet="BusinessPartners" Role="Relation_BusinessPartnerSalesOrders"/>

        <End EntitySet="SalesOrders" Role="Relation_SalesOrderBusinessPartner"/>

    </AssociationSet>

    <AssociationSet Name="SalesOrdersBusinessPartner_AssocSet" Association="ZCODEJAM02_SRV.SalesOrdersBusinessPartner" sap:creatable="false" sap:updatable="false" sap:deletable="false"sap:content-version="1">

        <End EntitySet="SalesOrders" Role="Relation_SalesOrderBusinessPartner"/>

        <End EntitySet="SalesOrderItems" Role="Relation_BusinessPartnerSalesOrders"/>

    </AssociationSet>

 

 

Anyone knows how to maintain the rolename of an endpoint?

Thanks,

Joachim

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Joachim,

I talked to our development team and got some answers to your questions.

  1. There is no way to set the naming of the end points so From_Role
    and To_Role cannot be changed.
  2. Since in OData v2 association sets are bi-directional it is not necessary to define 2 assications and 2 association sets. Having two of them is more seen like a bug.
  3. In the Odata V4 spec there will be no associations and association sets any more

Building consumers on top of a mandatory naming convention like it seems to be done by the

BreezeJS tool set can thus lead to problems.

Hope that this helps a little bit.

Best Regards,

Andre

Former Member
0 Kudos

No, Breeze does not have "mandatory naming conventions". The developer has complete control over the model schema and can manipulate the JSON payloads in either direction to match whatever you need. It's just a matter of knowing how.

Not sure what is meant by "For making the Breeze library to work I need to specify the inverse relation.

To specify this inverse relation I need to change the name of the role of each endpoint."  If you want bi-directional navigation between entities (Customer <--> Order), the necessary info needs to be in the JavaScript metadata. But that's not hard to arrange and I don't know what the "name of the role" has to do with it.

When I say I don't know, I mean "I don't know". You may know. Perhaps this is best worked through on StackOverflow (tagged with "Breeze" .. http://stackoverflow.com/questions/tagged/breeze?sort=newest) where we do most of our free support.

former_member182048
Active Contributor
0 Kudos

Hi Ward,

Thanks for taking the time to respond here in SCN.

Now that Breeze has Full ODATA CRUD support any plans for a SAP Netweaver Gateway Plugin, CSRF tokens etc? I am sure a few people in here would be interested in an alternative JS library.

Cheers

John P

joachimvanpraet
Active Participant
0 Kudos

Hi Ward,

You can find more detailed information on stackoverflow via this link:
http://stackoverflow.com/questions/16089360/breezejs-read-odata-link/16142003#16142003

kr,

Joachim

Former Member
0 Kudos

@John - Man would we like to have that!  I think we will although when is hard to say as there are so many bases to cover right now. We could use some help if anyone is offering (hint). Contact my by email.

@Joachim - I am looking at your SO question and will follow up there. Thanks for digging into this.

Answers (0)