MilkBottle
MilkBottle

Reputation: 4332

How to consume SAP Odata with Xamarin forms

I need to work on Xamarin forms and use it to consume SAP oData webservice. I dont seems to find any tutorial on this subject. This is what I need to do :
1) Consume SAP Odata and get the Data and insert it into local SQLite Table.
Can some1 provide:
a) What nuget to use for Xamarin forms for this task
b) reference links to Some Examples how to consume SAP Odata

Thanks

Upvotes: 0

Views: 932

Answers (1)

Richard
Richard

Reputation: 136

In order to work with SAP's OData services you should give a look at this article. It explains, step by step, how to consume SAP's OData services.

How to consume Service Layer odata service via WCF Add the metadata as service or file directly by selecting “Add Service Reference” into your C#/.NET based Microsoft Visual Studio project, the metadata will be validated automatically.

Note: You have two options:

Open a session with Service Layer before with the Login POST command, for example via PostMan or any other tool.Send a $metadata GET request with the B1S-WCFCompatible header property set to true.

Save the metadata response into an xml file.

Point to the metadata xml file from Microsoft Visual Studio Add Service Reference window:

  1. Directly put the $metadata link into the Add Service Reference window (without opening a session before).

You will be prompted to enter a User name and a Password:

As there is no input for company name in WCF, the username and company must be combined as a User name.

User name: {“CompanyDB”: “SBODEMOUS”, “UserName”: “manager”} Password: your user password

Microsoft Visua Studio IDE will use a tool named “SvcUtil.exe” to validate the metadata XML and generate proxy class for your usage automatically if validate passed. You can find all classes in “ObjectBrowser”.

With the automatically generated proxy classes, you can program the required business logic of your application

I would suggest you to use Simple.OData.Client, is a great library that lets you handle, in a very simple way, your OData resources and operations. You can performs CRUD operations in Linq like context.

Upvotes: 1

Related Questions