connect and access Function in Microsoft Dynamics NAV Web service from NodeJS? - node.js

I am new to SOAP we services and recently got task to consume existing NAV service from Node.js. My Node.js code is on Google cloud functions.
So far I tried really hard using this answer: Is it possible to access Microsoft Dynamics NAV Web service from NodeJS?
But it seems like I am not able to get any response except 'Nan'.
what should be my values for wsdl_headder and wsdl_option?
this is my request, REQUESTXML =
<GETDETAIL LanguageCode="ENG" ID="1042" TNo="T00205" TaxBreakdown="TRUE">
<SUBHEADERS>
<SUBHEADER Name="SALES"/>
</SUBHEADERS>
</GETDETAIL>
and this is what we call in OLD JAVA code,
xmlCommunicationPort.getdetail(REQUESTXML, returnString);
xmlCommunicationPort is the object created in during Authentication and getdetail is a method generated automatically by a java.

Related

Azure Easy API on Node.js 'No route registered for '/api/xxx'?

I'm having problems even running a simple Easy API method. I keep getting the response that says "No route registered for '/api/userInfo'".
I know that this location is correct because the I'm opening the App Service editor at https://XXXX/dev/wwwroot/api/userInfo.js
The file also has anonymous access, so there shouldn't be an authorization issue. I'm simply trying to hit the api method from a browser.
The code of this very simple method has been reduced to the following for debugging purposes
module.exports = {
"get":function(){
console.log('whooohooo');
}
};
Is there a setting I'm missing to enable the ability to call Easy API's? I've not been able to find any documentation that states that Easy APIs method must be explicitly enabled, nor can I find any settings related to enabling them.
Please note that I did not set up a Node.js project and deploy it to Azure. I am using an "out of the box" app service.
My end goal is to use an Easy API method go get an authenticated user's email and name, but my efforts have been reduced to confirming that I can call a method. Thanks in advance.
UPDATE:
I've created 3 different mobile App services with no luck and varying advantages.
App Service 1:
This Mobile Apps project is 10 months old and was created in the Azure portal. It has a routing line in the app.js file that suggest that the api route should be present, but doesn't work. I don't remember if i authorized the easy apis when i created it, but the fact that it has the following line suggests that I did
mobile.api.import('./api');
AppService 2:
This project was created in the MobileCenter using the Tables menu option for a Xamarin project. I then navigated to the Azure Portal and hooked up a SQL db to the table. I don't think I had the opt in to use Easy APIs, but the I was allowed to create an Easy API script, then edit it. Upon editing it, I realized that the project had no app.js file. Apparently web apps created via MobileCenter are created differently.
I picked this option because it allows you to use the "per-user" flag when setting up tables and doesn't require you to manually filter out data with a modification to the table's script. Apparently this is not an option if you don't set up an App Service via the MobileCenter??
App Service 3:
I created a brand new project within the portal and followed the the steps Aaron Chen laid out. I opted in, hooked up the table and modified the js file (I created a new one called 'testing'). I browsed to https://zzzzapitestzzzz1.scm.azurewebsites.net/api/testing
and got the dreaded no routes found error. Of course, the API method was created with anon access rights.
Basically, we can easily create an Easy API in the Azure portal.
Select your app service and click on Easy APIs in the MOBILE menu.
Enable Mobile extension for your app by clicking Need to configure Easy Tables/Easy APIs ...
Connect a database and then click Initialize App button.
After app initialized, you can add an API from Easy APIs blade.
Change the userInfo.js file to something like this:
Now, we can access the API with the endpoint http://<yourappname>.azurewebsites.net/api/userInfo.
For more info, please refer to this blog post.

How do I add behaviour to my Azure API (e.g. connect it to my back-end)?

I created an API in Azure portal, and it has a "product", whatever that means... Now how do I connect it to a back-end to add functionality?
I've seen many videos and tutorials (Channel 9 and others), and they all explain how to manage the API and so on.
I couldn't find any tutorial/explanation how to add actual functionality, so I suspect that I may not grasp this whole subject correctly...
You connect your own API to the Azure API in the "add API" dialog in Azure.
See http://azure.microsoft.com/en-us/documentation/articles/api-management-get-started/
=> Create an API
There is an input field "Web service URL". This is the url to your real api.
Azure API is only a wrapper which adds additional functionality to your API.

Azure Mobile Services : GET operation from table

I'm trying to get data from a table I created in Azure Mobile Services.
When I setup the service, I created a new database to go along with it.
I've added a row of data to my table called TODOITEM and can query this row of data fine from the db admin tool on Azure.
Now what I'm trying to do is run a GET request on this table, as documented here...
https://msdn.microsoft.com/en-us/library/azure/jj677199.aspx
I am using Fiddler and trying to send the following request with HTTP 1.1...
https://mobilemeshtest.azure-mobile.net/tables/todoitem
X-ZUMO-APPLICATION: my azure mobile services key
X-ZUMO-AUTH: my facebook authentication key
Host: mobilemeshtest.azure-mobile.net
No matter what I try, all I get back is a 404 not found.
I'm even copying what the guy did in a PluralSight video tutorial on Azure Mobile Services, and he gets a correct 200 response.
I can't see what I'm doing wrong.
404 is pretty simple. The url is wrong.
Propably you have not set your Controller right.
If your Controller is named SomethingController then the route is /tables/Something assuming you havent customized the default Routing methods
Application Key and Authorization Key is not needed if you haven't specified the corresponding authorization attribute
for example : [AuthorizeLevel(AuthorizationLevel.User)]
RESOLVED : I was using a .NET backend, it seems one has to publish their data objects and controllers first using Visual Studio.
This blog post has a good example on how to achieve this.
If I was using the Javascript backend option, the controllers are automatically setup for you.

SharePoint 2013 Provider Hosted

I want to create a web application that uses a custom database with a web api where javascript calls the api from html pages to perform basic crud operations.
The end game though is to surface this through SharePoint 2013 as a provider hosted application.
Can anyone advise on how I might go about this? I am particularly wondering how making ajax api calls to the application via the html pages surfaced from within sharepoint 2013 will work and authenticate.
Is the application using SharePoint data or are you just using your custom database? If you are just using your custom database, you can use the page viewer web part to display the application: http://office.microsoft.com/en-us/sharepoint-foundation-help/display-a-web-page-on-a-sharepoint-page-by-adding-the-page-viewer-web-part-HA101857182.aspx
If you are consuming SharePoint data, that is a different beast and your best bet is reading the docs here: http://msdn.microsoft.com/en-us/library/office/fp142381(v=office.15).aspx

Webservice to add users to SharePoint (like SPWeb.EnsureUser)

I need to add a user to a SharePoint-Website (WSS 3.0) via a Web Service.
Using the API I would use the SPWeb.EnsureUser method, but I can't run my own code on the server.
I was hoping the Users and Groups Web Service could help, but it does not provide a suitable method.
So, is there a Web Service equivalent to SPWeb.EnsureUser?
I stumbled across this question yesterday. As a matter of fact, there is a Web Service equivalent of web.EnsureUser, but it is not in the UserGroup Web service. Use the ResolvePrincipals method of the People web service (_vti_bin/people.asmx) instead.
Here is the Microsoft documentation.
The key is to feed in true for the value of addToUserInfoList. The PrincipalInfo object returned by the service call includes a UserInfoID, which you can use in other membership-related operations on that site.
Here is an example of using the web service from PowerShell 2.0:
$client = new-webserviceproxy http://mysharepointsite/_vti_bin/people.asmx?wsdl -usedefault
$person = $client.ResolvePrincipals(#('domain\user'), 'User', $true)
# ...

Resources