SAP: Discover available web services through a web service call? - c#

Sorry for my ignorance on SAP here, this is outside of my wheelhouse a bit and I'm trying to adjust.
As anyone who has worked with SAP knows, there's at least a dozen ways to do anything in the system... which is both good and bad. For what I'm trying to do (consolidate lists of security "items of interest"), it's mostly bad.
We have multiple completely separate SAP instances from various M&A's over quite a long time, and I am trying to find a common way to extract table information (user data and the like) from all of them without installing anything into the system itself. Consuming Web services seem to be the "right" way to do this. At the end of the day, I'd like to pull data from tables like USR02 and compare them against all these instances, looking for commonalities and near-misses that we'll have to investigate further.
What I'd like to know is if there is an SAP web service that I can rely on to tell me what web services are available on the Netweaver platform that I'm connecting to... or, failing that, a "default" web service that I can use to collect table information from whatever SAP table I want (that I have access to, naturally).
When I go to the WebService port in a browser, I get a 404, so I know it's listening... but there doesn't seem to be a directory listing, and I don't know how to find what I'm looking for... and SAP documentation has not been particularly helpful in this regard.
Can someone point me in the right direction?

Related

Microsoft Dynamics Nav Post using Web Services

Im trying to Post on Navision using Navision Web Services (using C#) but so far looks impossible, especially since I dont own developer license. But there are some Codeunits like Codeunit 22,23 which are supposed to do the post of Item Journals but I cant seem to make them work and cant find good info about how to do that. Any little help will be much more than appreciated.
If you were trying to publish those codeunits and try post like this then it is not good approach. And "cant seem to make them work" is just not enough to help you.
Most of customer licenses include free objects that can be created and modified w/o dev license. Those should have numbers starting from 50000 in object designer. I would advise you to create and publish codeunit within this range and call it from your application as web service.
In the codeunit you put creating and/or posting of journal lines. Calling posting codeunits from there should be no problem. But choosing of proper codeunit to call heavily depends on what exactly you are trying to post and what results you expect.

How do I maintain original datatypes in WCF Service proxy results

Unfortunately, I'm away from my computer now, I'll post my code and the error message as soon as I can, but maybe you'll have some suggestions without it?
I need to create a WCF Service Library which then I need to use as a proxy to connect to Microsoft Dynamics NAV 2009 R2 database from other applications.
I know, that I can easily connect to NAV's "Pages" from my application and extract data directly from them, but that will only work if the application is hosted at the same machine as Dynamics (please, correct me if I'm wrong).
When connecting to Dynamics NAV "pages" (which are web services) the tables are being mapped to classes, which then can be used in application. There is no problem as long as I'm not trying to make my OperationContract return objects of this classes (if I do that, I'm getting an error saying something about service metadata - I'll post the exact message when I'll be home).
I don't know if it's simply impossible (maybe because of some security reasons?) or I'm doing something wrong? I tried to follow this article.
Is there any other way to do that besides manually converting those objects to my own classes?
Thanks in advance!
UPDATE
I'm really sorry, totally forgot about this question.
I did not find a solution to my problem. However, I found out, that if I use "Web reference" instead of "Service reference", then I can reuse the datatypes returned by MS Dynamics NAV and return them as a result of my proxy's methods (don't really know why did it work this way, but it did). I did not want to use web reference, so I decided to create my own datatypes (data contracts) and map only the properties I needed. It was a good solution for me, since from most tables I needed only a few properties.
The question can be closed.

How should I interact with a database from a desktop application without opening it to the whole world?

Basically, I have a new desktop application my team and I are working on that will run on Windows 7 desktops on our manufacturing floor. This program will be used fairly heavily as it gets introduced and will need to interact with our manufacturing database. I would estimate there will (eventually) be around 100 - 200 machines running this application at the same time.
We're lucky here, we get to do everything from scratch, so we define the database, any web services, the program design, and any interaction between the aforementioned.
As it is right now, our legacy applications just have direct access to a database, which is icky. We want to not do that with the new application.
So my question is, how do I do this? Vague, I know, but basically I have a lot at my disposal here, and I'm not entirely sure what the right direction to go is.
My initial thought, based on what I've perceived others doing, is to basically wall off the database by using webservices. i.e. all database interactions from the floor MUST occur through the webservices, providing a layer of security by doing much of the database logic behind closed doors. Webservice calls are then secured to individual users via Active Directory.
As I've found though, that has some implications of its own... We have to abstract the data before it reaches the application. There's still potential for malicious abuse by using webservice calls repeatedly to ruin or spam data. We've looked at Entity Framework and really like what it provides, but as best I can tell, that's going to be unavailable by the time we're at the application level in this instance.
It just seems like I can't come to a conclusion on what is "right". So, what is right?
WebServices sounds like a right approach. Implementing a SOA-oriented layer on the webservices layer gives you a lot of control over what happens to the data at the database server.
I don't quite share your doubts about repeated calls doing any damage - first you can have an audit log of every single call so that detecting possible misuses is obvious. But you also could implement a role based security so that web service methods are exposed to users in roles, which means that not everyone will be able to call just any method.
You could even secure your webservices with forms authentication so that authentication is done against any datasource, not only the active directory.
And last thing, the application itself could be published as a ClickOnce application so that it is downloaded and executed from the web page and it automatically updates itself just as you publish new versions.
If you need some technical guidance, I've blogged on that years ago:
http://netpl.blogspot.com/2008/02/clickonce-webservice-and-shared-forms.html
My suggestion since you are greenfield is to use an API wrapper approach with Servicestack.
Check out: http://www.servicestack.net/ServiceStack.Northwind/
Doing that you can use servicestack authentication, abstract away your db layer (because you could move to a different DB provider, change its location, provide queues for work items etc...) and in time perhaps move your whole infrastructure to an internal intranet app.
Plus Servicestack is incredibly fast, interoperable with almost any protocol you through at it, and provides for running it through MONO, so you are not stuck with a MS backend that could be very expensive.
My two cents. :)
First of all this question is not appropiate for StackOverflow, you might get close-votes really quickly.
Second, You may want to have a look at WCF RIA Services for this.
These will allow you to create basic CRUD operations for all your entities, and stuff like that.
I never used this myself, no I'm not sure what the potential issues might be.
Otherwise, Just do what we did:
Create generic (<T>) interfaces and services and contracts and everything. This will allow you to adapt your CRUD functionality in your Services, DAOs, ViewModels and such to any entity type.

API that not exposes business Logic

I need to write a WCF services that bring data to reporting tool.
Reporting tool presents data in lazy way, till user not clicked it's not showing the data.
I cannot send everything in once because there can be several megabits of data and because of that I need to send it in portions.
The problem is that I don't want to create a lot of web functions for each report , because this way part of the BL will be in the reporting tool.
Is it possible somehow to make each report run in it's own web session and each time it's asks a next portion of data I will be able to send it back and everything made in the same session?
May be you have better solution to my problem .
There are a number of technologies that could help. I would take a look at WCF Data Services which allow you to do flexible querying (IQuerable) and association traversal which should take care of your lazy loading concerns without having to create a whole load of seperate WCF calls.
Also take a look at SQl Server Reporting Services which is a more general reporting solution that may appeal to you.
Either of these technologies should help you avoid your BL leaking into your reporting tool. There are probably a whole host of similar non-MS solutions that do similar things, but I have listed the two above as your are using WCF, so you are probably more familiar with the MS stack (but maybe that was a silly assumption by me...if thats not the case they will get you started on what to look for!)

What considerations need to be made when transitioning an application to support?

I will be taking on the role of support for a complex application that is transitioning from the development team. This application is a sharepoint solution that connects to several (7) web services. The development team is rolling off almost immediately and will be available only for small questions.
I'm new to this role so I'm wondering what suggestions you have for me as I take on this large project. What are some considerations that should be made so that the transition to support is smooth and uninterupted?
I've been reading the documentation but I can already see some gaps that need to be filled. The applicaiton is very (perhaps overly) configurable and there is lots of injected code. Stepping through the code is about the only way I can gain an understanding of what is actually happening.
It sounds like you've already got your environment set up if you're able to debug the application, so that's the first thing I was going to suggest in a knowledge-transfer situation. Some general things that I would get from the developers before they depart:
A list of third-party components that the application uses, along with license information and website logins if applicable.
Access to every part of the environment that this thing runs on, both production and development. That means the source code management system, database server(s), etc. It sounds like you have some of these already but make sure you get access to absolutely everything.
If your development environment was given to you "as is" (i.e. you took it over from one of the departing developers, make sure you know how to rebuild it from scratch. They might have a document that describes the process of building a development box, but if not maybe you can get them to show you how to set up a fresh machine.
Three will go a long way towards this, but if setting up a server to run the application is different in any way from setting up a development environment, you'd want to know how so you can diagnose server configuration issues if they crop up, or even rebuild a server. Although this sort of thing may be someone else's responsibility depending on your organization.
Once you have those, you probably want to get some understanding of why the application does the things that it does. That will give you the context you need to understand support and enhancement requests when they come in.
Are the original developers the only source of this information, or are there business people who you will be working with after the developers leave? One of the first things I try to do when starting on an existing application that's new to me is to find someone who knows the business well and have them give me a high-level run-down of the application's purpose in life. From there you can go into more detail on individual components/features/whatever as needed. The business people may be a better source for this information than the developers are, so you may want to try them first.
Hopefully some of that helps.
If you're not the systems admin (as opposed to the SharePoint admin), develop an understanding with them of what tasks you are able to do and what you need of them.
This may include things like stopping and starting services (IIS, Timer Service, etc.) and filesystem and DB monitoring and maintenance. Getting this sorted out up front saves a lot of pain later.
If the sys admins don't have some understanding of SharePoint, educate them. They will need to know what the deal is with things like code deployments.
It's best not to feel my pain.

Categories