web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

When to use a GP Web Service Extension vs. Custom Web Service

(1) ShareShare
ReportReport
Posted on by 210

Howdy Dynamics GP Community!  From Austin TX with Love :)

Well, I'm in the throws of a very interesting project.  My computer science geek is having  a hay day, that is for sure.  I'm doing a custom integration.  The application that is doing the integration or sync'ing of data is a .NET 4.0 C# WPF application.  On my customers side, I am talking to a WCF compliant End point to do CRUD operations.  On the Dynamics side, there are number of options.  Prior to this project, I had no experience with Microsoft Dynamics, but I have a lot of experience with MS-SQL, XML and Web Services, both ASMX and WCF.  So off we go.  

The Integration Challenge - What to use on the Dynamics Side?  Direct MS-SQL calls, eConnect or GP Web Services?  There is a lot written about that.  Here are a few of the links that have helped me navigate that question:

I really like working with Objects in Visual Studio instead of XML, call me spoiled by intellisense, cause I am.  As you probably already know, the schema of the Dynamics GP MS-SQL DB, is cryptic to say the least.  So trying to avoid direct SQL calls seemed like a good idea, but as I got into it more and more, avoiding making direct SQL calls and having to search through the exquisitely confusing data model of Dynamics GP is pretty much unavoidable.  The GP Web Services security plugin is just good form when dealing with Accounting data.  From a liability point of view, I'd rather be able to say that Microsoft built the security layer rather than me.  Also, the GP Web Security plugin integrates with active directory, which SysAdmins will appreciate.  I also like the Web Services exception handling plugin.  Its handy for sure, but mostly just isolates Dynamics exceptions from other system exceptions found in the event viewer.    
So, we decided to go with Dynamics Web Services initially to do our integration.  Off we go.  First hurdle.  I'd like to be able to get the human readable description of ProjectBudget.ProjectBudgetkey.CostCategoryKey so our application can display that same ProjectBudgetCostCategory as Dynamics.  Guess what?  Not provided functionality via GP Web Services...  hmmm... so, how to address?
This is where the meat of this discussion comes in.  The next layer of customizing GP Web Services.  GP Web Service Extensions or a Custom Web Service?  What to use, when and why.  I haven't found much out there about this and there certainly isn't much out there about the level of effort between both.  
Oh the ways we Computer Scientist love to skin that cat.  ;)  You can see my post on Cost Category Description here:  https://community.dynamics.com/gp/f/32/p/23679/222111.aspx#222111  In this post, you'll get to see me create a GP Web Service Extension and also get step by step instruction of how to debug a GP Web Service Extension.    
Web Service Extensions are actually pretty easy to create, especially when compared with a custom web service.  In a rare occurrence, Microsoft's Documentation about how to create both a Web Service Extension and/or a Custom Web Service, is actually REALLY GOOD.  Step by step for dummies type documentation.  http://msdn.microsoft.com/en-us/library/cc508802.aspx  I knocked my first Web Service Extension out in a day.  Also highlighted in that post is how to debug a web service extension.  
Here is the the elevator pitch of Web Service Extensions.   Mostly, any object in GP Web Services that has real data in it, not a Summary Object, extends a base class BusinessObject.  BusinessObject.Extension provides a framework for attaching custom XML to said BusinessObject.  So, to get my Cost Category Description, I extended the ProjectBudget - http://msdn.microsoft.com/en-us/library/cc508336.aspx with some XML.  I had to make a custom SQL Call to the DB to get the data, then build the XML document and then attach it to BusinessObject.Extension.  Why I say, that its pretty much unavoidable to deal with the cryptic nature of the GP MS-SQL Database Schema.  
A great resource for navigating the beautiful DB structure of Dynamics GP is http://www.gptablereference.com/  As well, inside the the SDK (2010), C:\Program Files (x86)\Microsoft Dynamics\GP 10.0 SDK\Content\DatabaseDiagrams, VISIO diagrams can be found by module for the database.  I have also found some SQL scripts that find column names from System Tables pretty useful.  
So now I have an list of ProjectBudget items,which are projects broken down by Cost Category WITH human readable Cost Category Descriptions being returned inside the extension.  Yeah!  The returned list of ProjectBudgets gives me everything I need to populate our application, projects by cost category that are human readable.  This works because this gives me all projects with all cost categories, which is what I need.  
Next challenge.  PayCodes.  Unlike creating a web service extension for project.costcategory, creating a employeepaycode extension that gives me the human readable paycode description doesn't guarantee me that I will get a comprehensive list of the paycodes available in Dynamics.  I'll get a list back of all of the paycodes taht have been associated with an employee, but not the comprehensive list.  As our friends in London Underground like to say, Mind the Gap!  So, what to do?  In comes the Custom Web Service.  I have to create my own BusinessObject derived class and add it as a Custom Web Service, PayCodes.  
So, how I see the line between and extension and custom web service.  If you want to attach some BusinessObject specific data to a specific instance of a BusinessObject that is NOT part of the GP standard Web Services API, you can do this pretty easily with a GP Web Services Extension.  If you want some data from Dynamics Web Services that won't give you a comprehensive look by attaching it to an included BusinessObject, you have to create your own derived  BusinessObject and and then create a Custom Web Service around it.  http://msdn.microsoft.com/en-us/library/dd996562.aspx
Custom Web Services is a much more complicated process.  It requires the ability to create stored procedures, write SQL, understand and perform XML XSLT transformations, install and configure eConnect, create eConnect XML documents and a good if not full understanding of how to create a WCF end point and further how to decipher the Dynamics Web Services Framework.  There is a lot more to do to create a Custom Web Service. 
I'm going to dive into creating a Custom Web Service and I'll outline my experience in this post so others may hopefully, gain some knowledge from my experience.  
Matt

*This post is locked for comments

I have the same question (0)
  • Josh P Profile Picture
    2,895 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Hi Matt,

    Quite a post there. Here are some thoughts to mull over too:

    I've used the web service, and it is nice for most normal web-GP integration needs. It is however incredibly slow out of the box and needs to be customized to have speed. This means getting rid of all the extra overhead the service reference provides you. In one instance I simply rolled out the GP tables that I needed into objects, and mapped them using a code-first entity framework approach. This way, I could use select statements to my heart's content. This will be much faster for building something along the lines of reporting.

    For pushing data, I used entity framework's direct SQL calls to the GP stored procedures to push data. This allowed me to use the objects I already have for mapping GP's tables to objects on one-to-one basis, keep GP's business logic by altering the stored procedures using eConnect's preferred method for custom business logic, and have it all wrapped up in one liner calls to the data layer.

    The cool thing here is I can give this to anyone who knows how to write linq queries, and they can read through it for a basic understanding without knowing GP's obnoxious physical naming conventions. Here is an example class that I set up in my data context (repository link with some code). The neat thing too is you can write a simple script to map all the pertinent classes you need, and strip out the fields you don't for custom classes that pull from the same tables.

    gist.github.com/.../6275010

    Now, the web service is cool for what it is, and there are a lot of predefined methods that make your life easier. For the most part, these are all built on the eConnect platform working behind the scenes as the engine. Depending on your needs, you can always roll out a more streamlined authentication system for example that hooks through your data connector and SQL. Considering GP uses SQL authentication, there is no reason why your custom web app cannot do the same. There are also limitations that require workarounds and customization which are annoyances at most, but these annoyances can be a time suck too when looking at development time.

    I also am a big fan of the MVC framework over WCF. Not only do you get to use the pre-built web API which lets you roll out json, html direct, text, xml, whatever you want connectors, it is also easier to customize in my opinion. You can still keep the GP business logic intact by using eConnect as your primary integration source. You have the option of using Microsoft's libraries, or you can modify the existing stored procedures without breaking the GP business logic.

    The question really comes down to what are you comfortable with?

    Have fun on your journey, and let us know how things progress.

  • BCSATXMatt Profile Picture
    210 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Hey Joshua,

    An update.  I went on vacation for a week the day after i wrote the big post.  Been chewing on this quite a bit along with sorting business logic around our requirements.  The program I am writing is WPF and will always be run inside the secure network of the GP user.  The HUGE pain in the arse and abstraction/transformation exercise that WCF->eConnect->MS-SQL is, while impressive is just to heavy weight to be of use to us and would be an undue burden on our customers, installing web services, installing our custom web services and extensions, web services security to name a few.  So, I've thrown the entire idea of WCF out the window and have gone for Entity Framework with SQL Authentication, which just kicks butt in just about every way possible accept one, stored procedure system analysis.  

    When getting data, its pretty straight forward, I can just run queries.  However, I'm now starting to look down the wabbit hole of creating data in Dynamics.  Understand that all Business Logic in GP is done at the Stored Procedure level and that eConnect is primarily trying to abstract that into a business document interface.  Ran a little SQL Script today and found that there are 20,031 Stored Procs in GP2010.  The naming isn't any better of Stored Procs than on Tables.  Besides using SQL Profiler and system table queries to decipher eConnect, is there something out here in developer world that shows the pathway through the Dead Marshes (Lord of the Rings Reference) of GP Stored Procedures for some pretty standard CRUD operations?

    Matt

  • BCSATXMatt Profile Picture
    210 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    I found the answer to my own question.  stackoverflow.com/.../search-text-in-stored-procedure-in-sql  GREAT SQL Script to search to txt in stored procedures, views etc. in SQL Server.  I've already used this to isolate the Stored Procs on a number of tables.  I LOVE SQL!!!

  • Suggested answer
    sandipdjadhav Profile Picture
    18,306 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Hello,

    I used both Custom Web Services and Dynamics GP Web Services. Instead of using eConnect I will prefer use Dynamics GP Web Services.

    In Dynamics GP Web Services if some web methods are missing then you can use eConnect - Wrap eConnect into Custom WebServices and use it. I have done lot including creating project Budgets.

    Please let me know if you need any help from my end.

    Thanks

    Sandip

  • Josh P Profile Picture
    2,895 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    A good place to start is here:

    msdn.microsoft.com/.../bb219081.aspx

    Don't use the standard GP stored procs. Use the econnect specific ones because they can be modified and still retain GP business logic. The link above will give you information to get started.

    Most of the classes in econnect have a stored procedure with the equivalent name. They all typically start with "ta." There are three sets for each integration. The ones that have "pre" and "post" in the name are not encrypted and can be modified with custom business logic to suit your needs. The pre runs before the econnect stored proc, and the post runs after.

    They are commented well, and the error reporting is good if you use it correctly. This is of couse if you are absolutely dead set on using the eConnect stored procs directly. I would use the eConnect processes using the dlls for sending data. Then, use entity framework to pull data from GP.

  • BCSATXMatt Profile Picture
    210 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    A followup on this thread.  In the end, I utilized Entity Framework to pull data from GP and then utilized eConnect to Push data, therefore utilizing the business logic of the GP store procedures.  I really loved the idea of using the WCF Endpoint in the beginning of the project.  Using Web Extensions were pretty straight forward and usefully, but when a new Web Document had to be created, its was just to many layers when utilizing the drag and drop ease of Entity Framework and Linq had me pulling data in less than a day.  Entity Framework to pull data with eConnect to push would be my suggestion to anyone facing this challenge.  

  • Josh P Profile Picture
    2,895 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Thanks for the update Matt. Now that you have gone the route of EF and e-Connect, make sure to check the updates to tables on GP service packs before installs happen on the client computers.

  • BCSATXMatt Profile Picture
    210 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Joshua,

    Thanks much for your help during the process.  And, Yes, you are correct again, that the physical data structure of the GP changes between versions/service packs.  So, the Entity Framework model is version specific, which presents its own set of version challenges.  Can you say more about how you have addressed GP Data model versions?  

    Thanks,

    Matt Butler

  • Josh P Profile Picture
    2,895 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Partner Source outlines the changes on SP releases, but I believe you can also get this through Customer Source if you are not a Microsoft Partner. If neither of the first two are available, there are also numerous blogs available online, but most of the time, these are not up-to-date until after the SP releases.

    Certified MS GP customizations are required to be compliant for all SP releases, and this information comes generally through partner accounts with MS.

    I have seen that most minor releases (service packs) have additions to table structures, not usually deletions or renamed objects. This means that e-Connect and EF objects should not be harmed as long as your object mapper does not force all fields to be present for mapping. These would probably only require debugging review to make sure the system still works as expected, and deal with bugs as they appear.

    Major releases (GP versions) is fair game for changes all the way around the board. These require complete code review (usually.)

  • John Higgins Profile Picture
    40 on at
    RE: When to use a GP Web Service Extension vs. Custom Web Service

    Hi,

    I am trying to create a purchase invoice via the GP 10 web service. I am setting the project key and cost category key - but it is failing as it requires Item Number or Vendor Item Number. When I provide one, it still fails by giving the same error. Is this a web service limitation? Will I have to use eConnect for this? I am getting the errrors below - none of these make sense as they are not valid

    Validation Errors:

    - ItemKey and VendorItemNumber cannot both be empty.

    - The ItemKey/VendorItemNumber is not assigned to the vendor.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans