Quantcast
Channel: GPWindow.com - Dynamics GP- INTEGRATIONS > eConnect
Viewing all 30 articles
Browse latest View live

Check eConnect 2010 Service Status Programmatically

$
0
0
The number one eConnect 2010 issue that I've been asked to resolve has been the following error that I discussed back in September:

There was no endpoint listening at net.pipe://localhost/Microsoft/Dynamics/GP/eConnect/EntityOperations that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

The problem with this eConnect error is that it is useless for the average GP user, presumably because it is just a lower level WCF error being communicated up through eConnect.  Not only is it too technical, but it is misleading at best.  If a user runs your eConnect 2010 integration and sees this error, they will e-mail you or pick up the phone.  I've also found that it's useless for many GP consultants, as I've received several inquiries from consultants as well, repeatedly asking about this error.

What is frustrating is that the issue is so simple:  The error is almost always caused because the eConnect 2010 Integration Service is not running.

Unfortunately, I don't know why the service is stopping on the client servers, but since I can't directly control all of my clients' servers, I can only try and deal with the error more gracefully and give them enough information to resolve it without having to call me.

And so I wondered, can I just put some code in my integrations that can detect the status of the eConnect 2010 service before I even try and call it?  I've never tried checking the status of a Windows service, and although I assumed it was possible, I didn't know how difficult it would be.  Well, after receiving yet another e-mail about this issue tonight, I finally took a few seconds and read how to detect the status of a Windows service using .NET.

This great tutorial article told me all that I needed to know to check the service status in less than 60 seconds.

It's wonderfully simple--in just a few lines of code, you can tell if the eConnect 2010 service is running. Here is a basic example:

ServiceController byConstructor = new ServiceController("DynGP11eConnect");

if (byConstructor.Status != ServiceControllerStatus.Running)
{
    MessageBox.Show("The eConnect 2010 Integration service is NOT running.");
}
else
{
    MessageBox.Show("The eConnect 2010 Integration service IS running.");
}

Other than those few lines, just make sure to add a reference to System.ServiceProcess, and then add using System.ServiceProcess; to your class.

It's that easy!

I would personally recommend adding this service status check to any eConnect 2010 integration.  I'll be adding it to my standard Functions library that I use with all of my integrations.


Steve Endow is a Dynamics GP Certified Trainer and Dynamics GP Certified Professional.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

http://www.precipioservices.com

Why eConnect use Windows Authentication?

$
0
0

While I am going to talk about eConnect, I would like to disclaim that the explanations are JUST out of my understanding of the concepts of eConnect and the structure. Please do refer to some more articles from Microsoft, Consultants worldwide and others to know more about this and also correct my own understanding in case you find it irrelevant.

eConnect use Windows Authentication to converse with GP Databases instead of the traditional SQL Authentication (which GP uses). There could be various reasons why it is designed in such a way. I am listing some of the important reasons:

1. eConnect does not require GP Application, or precisely, it does not depend on an Instance of GP Application to be running (which is the case with Integration Manager for most of its Integrations). This would mean that, the login credentials for an eConnect integration cannot be inherited from anywhere. We still have to establish a Connection String (ODBC) to the GP Databases to access the data and manipulate it.

2. eConnect is designed to run in the background and access/manipulate the GP databases without anyone's idea of what's going on with the records and database. Apparently, there should be a kind of authentication which is much more stronger than the basic SQL Authentication, which the Windows Authentication provides us.

3. eConnect is the base for almost all the web based features we have for Dynamics GP, such as Webservices, Business Portal, etc. We cannot have a compartively weaker Authentication level when we allow anyone to access GP Databases from anywhere.

4. eConnect can utilize MSMQ (Microsoft Message Queuing), to queue the integrations from anywhere to the Dynamics GP server. In such cases, it has to have a Windows Authentication to pass the MSMQueuing validations.

I am still learning more concepts on these two Authentications and its scope with respect to GP and related products. I will update more points with references, so it does not just go in as a theory.

Vaidy

Blank Currency ID During an econnect Integration

eConnect Integration experiences

Leveraging the changes in eConnect for Microsoft Dynamics GP 2010

$
0
0

Chris Roehrich - Click for blog homepageIn this post I will talk about the changes made to the API for eConnect for Microsoft Dynamics GP 2010 and how developers can take advantage of these changes to affect their custom application.   If you have been using eConnect 2010 you have already realized that there is a new Windows service running called the eConnect for Microsoft Dynamics GP 2010 Integration Service.   This is a change from the version 9 and 10 days where there was a COM+ application for eConnect that appeared under Component Services.  Like the eConnect COM+ application, the eConnect 2010 service runs under a Windows user that requires DYNGRP role access in the DYNAMICS and company databases.  I will breakdown some of the other changes in the following sections.

 

eConnectMethods Class

There are several new methods added to this class and they are discussed in the eConnect Programmers guide in MSDN here.   These methods provide the functionality for reading and writing to the Dynamics GP databases.   One of the more interesting changes is that the CreateTransactionEntity method returns a string value.   This string is the XML that is passed to the eConnect API and it includes the generated Document Number of the transaction.    So if you are integrating Sales Transactions and do not pass the SOPNUMBE value in the XML, the eConnect API retrieves the next number internally and you will then be able to see the SOPNUMBE in the string value returned by the CreateTransactionEntity method.

The CreateEntity, CreateTransactionEntity, DeleteEntity, DeleteTransactionEntity, UpdateEntity, and UpdateTransactionEntity may have different names but they all go down the same road.   In other words, right now they have been named this way for readability but have no real big differences.  For instance, it is possible to create a GL Transaction by passing a GL Transaction Type XML document to the DeleteEntity method.   The only difference between these methods is that the CreateTransactionEntity returns a string and the others return a bool!   An advantage to having different naming conventions would be for readability of your code.   If you have an application that does multiple operations like creating new transactions, updating existing customers, and deleting addresses, you could pass the specific XML documents to the desired methods so the code would be easier to understand from a developer perspective.   For example, you would pass your XML document that updates a customer record to the UpdateEntity method and you would pass a new Sales Invoice transaction XML document to the CreateTransactionEntity method.  

 

RequireProxyService

You can bypass using the new eConnect Windows service so your application calls the eConnect stored procedures under the context of the user running the application.  Thus the eConnect service does not even need to be running and the user(s) running the application will need to have access in SQL server.  You can give them DYNGRP role access or something more granular like spefic access to eConnect stored procedures and tables.  You can take advantage of this option in a couple ways where you will set the RequireProxyService configuration property to false.   The default value for this setting is true so by default the eConnect service needs to be running.   If it is not, you will receive a "There was no endpoint listening at net.pipe://localhost/Microsoft/Dynamics/GP/eConnect/EntityOperations that could accept the message" error when the eConnect API attempts to intialize the service proxy.  

There are two ways to use this configuration setting:

1.  Add a key for this setting in your application config file like below:

     <?xml version="1.0"?>
     <configuration>
       <appSettings>
         <add key="RequireProxyService" value="false"/>
       </appSettings>
     </configuration>

 2.  In your application code, set the RequireProxyService property of the eConnectMethods class to false:

   // Add reference to Microsoft.Dynamics.GP.eConnect.dll in Visual Studio Project

   // Add using statement to Microsoft.Dynamics.GP.eConnect namespace
   using Microsoft.Dynamics.GP.eConnect;

   // Instantiate eConnectMethods class to use RequireProxyService
   eConnectMethods eConnect = new eConnectMethods();
   eConnect.RequireProxyService = false;

 

An interesting related tidbit is that the Web Services for Microsoft Dynamics GP 2010 takes advantage of this setting.  If you have the Microsoft Dynamics GP Web Services installed, take a peek at the WSServiceAppSettings.config file under the C:\Program Files\Microsoft Dynamics\GPWebServices\ServiceConfigs folder.   You will see a line at the bottom of the file that sets the RequireProxyService to false.   You can even go ahead and stop the eConnect Integration Service and attempt a call to a method in the Microsoft Dynamics GP 2010 Web Services and it will be successful.   Go ahead I know you want to try!  The web services call will be successful because the eConnect service proxy is bypassed and the call to the eConnect SQL objects is made under the context of the user running the Microsoft Dynamics GP Service Host service that is used by the Microsoft Dynamics GP 2010 Web Services.

 

ReuseBaseTransaction

When using multiple transaction types in a single XML document, a change to the API for eConnect 2010 was made in regards to the way transactions are processed.  If you use the eConnectProcessInfo node for each transaction type in the XML document, then each transaction type will run as a seperate transaction.   This is fairly signficant because the entire XML document is not treated as one transaction.  So transaction types that are successful will not rollback if an error is hit with a transaction type that runs later in the XML.  Take for example the following XML:

  <eConnect>
  <SOPTransactionType>
    <eConnectProcessInfo>
      <ConnectionString>Server=SQLSVR;Database=TWO;integrated security=SSPI;persist security info=False;Trusted_Connection=Yes</ConnectionString>
    </eConnectProcessInfo>
    <taSopLineIvcInsert_Items>
      <taSopLineIvcInsert>
        <SOPTYPE>2</SOPTYPE>
        <SOPNUMBE>ORDNJ00069168</SOPNUMBE>
        <CUSTNMBR>AARONFIT0001</CUSTNMBR>
        <DOCDATE>3/16/2011 12:00:00 AM</DOCDATE>
        <LOCNCODE>WAREHOUSE</LOCNCODE>
        <ITEMNMBR>256 SDRAM</ITEMNMBR>
        <AutoAssignBin>0</AutoAssignBin>
        <UNITPRCE>15.00</UNITPRCE>
        <QUANTITY>48.00</QUANTITY>
        <DOCID>STDORD</DOCID>
        <UOFM>EACH</UOFM>
        <DEFEXTPRICE>1</DEFEXTPRICE>
      </taSopLineIvcInsert>
    </taSopLineIvcInsert_Items>
    <taSopHdrIvcInsert>
      <SOPTYPE>2</SOPTYPE>
      <DOCID>STDORD</DOCID>
      <SOPNUMBE>ORDNJ00069168</SOPNUMBE>
      <LOCNCODE>WAREHOUSE</LOCNCODE>
      <DOCDATE>3/16/2011 12:00:00 AM</DOCDATE>
      <CUSTNMBR>AARONFIT0001</CUSTNMBR>
      <CREATECOMM>1</CREATECOMM>
      <CREATETAXES>1</CREATETAXES>
      <DEFTAXSCHDS>1</DEFTAXSCHDS>
      <DEFPRICING>1</DEFPRICING>
      <BACHNUMB>CPR 66</BACHNUMB>
    </taSopHdrIvcInsert>
  </SOPTransactionType>
  <POPTransactionType>
    <eConnectProcessInfo>
      <ConnectionString>Server=SQLSVR;Database=TWO;integrated security=SSPI;persist security info=False;Trusted_Connection=Yes</ConnectionString>
    </eConnectProcessInfo>
    <taPoLine_Items>
      <taPoLine>
        <PONUMBER>A-0001</PONUMBER>
        <DOCDATE>2011-05-02</DOCDATE>
        <VENDORID>ACETRAVE0001</VENDORID>
        <LOCNCODE>WAREHOUSE</LOCNCODE>
        <VNDITNUM>256 SDRAM</VNDITNUM>
        <ITEMNMBR>256 SDRAM</ITEMNMBR>
        <QUANTITY>1</QUANTITY>
        <REQDATE>2011-05-09</REQDATE>
        <RELEASEBYDATE>2011-05-02</RELEASEBYDATE>
        <PRMDATE>2011-05-09</PRMDATE>
        <PRMSHPDTE>2011-05-02</PRMSHPDTE>
        <UNITCOST>3164</UNITCOST>
        <UOFM>Each</UOFM>
        <ORD>16384</ORD>
      </taPoLine>
    </taPoLine_Items>
    <taPoHdr>
      <PONUMBER>A-0001</PONUMBER>
      <VENDORID>ACETRAVE0001</VENDORID>
      <VENDNAME>IRIDIUM SATELLITE LLC</VENDNAME>
      <DOCDATE>2011-05-02</DOCDATE>
      <PRMDATE>2011-05-09</PRMDATE>
      <PRMSHPDTE>2011-05-02</PRMSHPDTE>
      <REQDATE>2011-05-09</REQDATE>
    </taPoHdr>
  </POPTransactionType>
  </eConnect>

 If the SOP transaction is successful but the POP transaction fails for some reason, the SOP transaction will not rollback.   This is a change when compared to how this worked in previous versions of eConnect.   However, there is a configuration setting called ReuseBaseTransaction that can be used to make sure that each transaction type will use the same SQL connection so everything would rollback in the XML document.  You can set ReuseBaseTransaction to true by adding it to your application config file or the Microsoft.Dynamics.GP.eConnect.Service.exe.config file depending on if you are using the service proxy (RequireProxyService).

     <?xml version="1.0"?>
     <configuration>
       <appSettings>
         <add key="ReuseBaseTransaction" value="true"/>
       </appSettings>
     </configuration>

 Keep in mind this behavior change only happens when using multiple transaction types in your XML document AND using a eConnectProcessInfo node in the transaction type.   If you do not use eConnectProcessInfo, then the same transaction is used by default for the entire XML document.

 

Using the eConnect WCF Service

You may choose to use the eConnect Integration Service by making a service reference in your Visual Studio project.   The programming reference and techniques for doing so are discussed in MSDN here.  The eConnect Integration Service is a new WCF service available in the 2010 version of eConnect.  So if you are developer with experience around WCF programming techniques or want to do more with WCF, this is one strategy to use with an upcoming eConnect project.  When using the eConnect Integration Service as a Service Reference, you do not need to make a reference to the Microsoft.Dynamics.GP.eConnect assembly since all the classes are available with your service reference.  You would still need to make a reference to the Microsoft.Dynamics.GP.eConnect.Serialization assembly to help in constructing eConnect XML documents if necessary.

One advantage I have seen in a few cases so far is the ability to call into eConnect with a specified Windows account.   This may come into play when you have a web application that supports Anonymous or Forms based authentication and the web application needs to call the eConnect API to interact with Dynamics GP.   If you are using the Service Reference, you have access to a DynamicsGPClient object which gives you access to a ClientCredential property.   In the below code example, I use the System.Net namespace to use a NetworkCredential object that I can pass to the ClientCredential.  

// 1. Make a Service Reference to net.pipe://<computername>/Microsoft/Dynamics/GP/eConnect/mex in Visual Studio project.
// 2. Add a using statement to the System.Net namespace.
// 3. Add a using statement to the Service Reference (Ex: using eConnectWebApplications.eConnectService;)

protected void Button3_Click(object sender, EventArgs e)
        {
            // Initialize a new instance of the eConnectClient
            eConnectClient eConnectObject2 = new eConnectClient();

            eConnectObject2.ClientCredentials.Windows.ClientCredential = new NetworkCredential("eConuser", "()Redrabbit", "croehric1");

            eConnectObject2.CreateTransactionEntity("blah blah","blah blah");
           
        }

 

Using the above pattern I can pass a specific Windows user credential to the eConnect API that will have access to the eConnect Integration Service because it is a valid Windows user.  Depending on the web site security and configuration, if I do not do this then I may receive a message that says something like:

The pipe name could not be obtained for the pipe URI: Access is denied.  (5, 0x5)


Tracing Steps 

On version 9 and 10 of eConnect it was possible to do tracing of the eConnect API but you could only do it by modifying the .Net Framework machine.config file and then give the COM+ user account for eConnect Full Control to the root of the C drive.  That was not always ideal.  Things have changed for the better when it comes to tracing in eConnect 2010! 

In addition to tracing the eConnect API which gives you insight into the XML string passed and connection string info, you can also initialize tracing the WCF layer.   So any type of exception in the WCF layer can be traced.   You can add tracing information to either your application config file if you are setting RequireProxyService="false" or you can add tracing information to the Microsoft.Dynamics.GP.eConnect.Service.exe.config file if RequireProxyService="true".   Remember the latter setting is the default and right now the most common usage we see.   I always use the below tracing information so to make things easy I will just copy my entire Microsoft.Dynamics.GP.eConnect.Service.exe.config file which you can copy into your Microsoft.Dynamics.GP.eConnect.Service.exe.config file or simply replace it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
    <sources>
      <source name="eConnectTraceSource" switchValue="Verbose">
        <listeners>
          <add name="eConnectTextTracelistener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="eConnectServiceTraceSource" switchValue="Verbose">
        <listeners>
          <add name="eConnectSvcTextTracelistener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel" switchValue="Verbose" propagateActivity="true">
        <!--Values can be:http://msdn.microsoft.com/en-us/library/ms733025.aspx -->
        <listeners>
          <add name="wcfListener"/>
        </listeners>
      </source>
      <source name="System.IO.Log" switchValue="Verbose" propagateActivity="true">
        <listeners>
          <add name="wcfListener"/>
        </listeners>
      </source>
      <source name="System.Runtime.Serialization" switchValue="Verbose" propagateActivity="true">
        <listeners>
          <add name="wcfListener"/>
        </listeners>
      </source>
      <source name="System.IdentityModel" switchValue="Verbose" propagateActivity="true">
        <listeners>
          <add name="wcfListener"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="C:\Program Files\Microsoft Dynamics\eConnect 11.0\eConnectSvc.log" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="eConnectSvcTextTracelistener">
        <filter type="" />
      </add>
      <add initializeData="C:\Program Files\Microsoft Dynamics\eConnect 11.0\eConnectSvcLog.xml" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="eConnectSvcXmlTracelistener">
        <filter type="" />
      </add>
      <add initializeData="C:\Program Files\Microsoft Dynamics\eConnect 11.0\eConnect.log" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      name="eConnectTextTracelistener">
        <filter type="" />
      </add>
      <add initializeData="C:\Program Files\Microsoft Dynamics\eConnect 11.0\eConnectLog.xml" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="eConnectXmlTracelistener">
        <filter type="" />
      </add>
      <add name="wcfListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Program Files\Microsoft Dynamics\eConnect 11.0\WCFTracing.svclog"/>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <diagnostics wmiProviderEnabled="true">
      <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
        logMessagesAtTransportLevel="true" />
    </diagnostics>
    <bindings>
      <netNamedPipeBinding>
        <!--The following Buffer Sizes are required in order to handle large XML messages in eConnect-->
        <binding name="eConnectNamedPipeConfig" closeTimeout="00:10:00"
          sendTimeout="00:10:00" receiveTimeout ="infinite" transferMode="Buffered" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="60" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Transport">
            <transport protectionLevel="EncryptAndSign" />
          </security>
        </binding>
      </netNamedPipeBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="eConnectServiceBehavior" name="Microsoft.Dynamics.GP.eConnect.Service">
        <endpoint address="EntityOperations" binding="netNamedPipeBinding" bindingConfiguration="eConnectNamedPipeConfig"
          name="eConnectServiceEndpoint" contract="Microsoft.Dynamics.GP.eConnect.IEconnect">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="GetDocumentNumbers" binding="netNamedPipeBinding" bindingConfiguration="eConnectNamedPipeConfig"
          name="eConnectDocNumberEndPoint" contract="Microsoft.Dynamics.GP.eConnect.ITransactionRecordIds">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="RollBackDocuments" binding="netNamedPipeBinding" bindingConfiguration="eConnectNamedPipeConfig"
          name="eConnectRollBackDocuments" contract="Microsoft.Dynamics.GP.eConnect.IDocumentNumberRollback">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexNamedPipeBinding" name="http" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <!--Net Pipe (NamePipes) creates an IPC call to this eConnect Service-->
            <add baseAddress="net.pipe://localhost/Microsoft/Dynamics/GP/eConnect/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="eConnectServiceBehavior">
          <!--Leaves this to true in order to receive Exeption information in eConnect-->
          <serviceDebug includeExceptionDetailInFaults="true" />
          <!--This settings turns on Metadata Generation. Metadata allows for consumers to add service references in Visual Studio-->
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost/Microsoft/Dynamics/GP/eConnect/mex"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

 

The tracing output will create files in the C:\Program Files\Microsoft Dynamics\eConnect 11.0 folder.   The Windows user running the eConnect Integration Service will need Full Control to this location to make sure all the files are written to it.   The settings I used above are set to "Verbose" so the files can grow to a large size quickly if this is left on and you have a heavy integration.  I would advise to use tracing only in troubleshooting issues with eConnect.   An example would be when you use the Web Services for Microsoft Dynamics GP 2010 since tracing will give you access to the generated eConnect XML document serialized by the Web Services.  

When using the above tracing information that I provided, the eConnect.log file can be viewed to see the generated eConnect XML passed to the API along with the connection string.   The files that end with .svclog are WCF trace files and can be viewed with Notepad but they are difficult to read.   If you have the Windows SDK installed from Visual Studio, you may have the Service Trace Viewer application (C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\SvcTraceViewer.exe) which is great for loading up .svclog files and finding information about exceptions easier.

 

I know there has been a number of changes with the eConnect 2010 release and unfortunately I can't cover all of them here but hopefully this will be helpful for you.

Chris

Quick Tip: Using eConnect to update Customer or Vendor Addresses with a blank Address Line 3

$
0
0

David Meego - Click for blog homepageI had a case this week that was asking a fairly commonly asked question about integrating address information using eConnect. The scenario is that we want to update a customer or vendor address and the previous address had three lines in the address and the new address only has two lines. When the update is processed, Address Lines 1 and 2 have been updated, but Address Line 3 has the old data and has not been cleared.

So how can I update Address Line 3 with blank data?

Background

Let's start with a little more background information.

Using the <taCreateVendorAddress> node, we can create a new vendor address with 3 lines. Below is the example XML used:

<eConnect>
  <PMVendorAddressType>
    <taCreateVendorAddress_Items>
      <taCreateVendorAddress>
        <VENDORID>ACETRAVE0001</VENDORID>
        <ADRSCODE>WAREHOUSE</ADRSCODE>
        <UPSZONE></UPSZONE>
        <SHIPMTHD></SHIPMTHD>
        <TAXSCHID></TAXSCHID>
        <VNDCNTCT></VNDCNTCT>
        <ADDRESS1>Unit 42</ADDRESS1>
        <ADDRESS2>XYZ Building</ADDRESS2>
        <ADDRESS3>100 Main Street</ADDRESS3>
        <COUNTRY>Australia</COUNTRY>
        <CITY>Perth</CITY>
        <STATE>WA</STATE>
        <ZIPCODE>6000</ZIPCODE>
        <PHNUMBR1></PHNUMBR1>
        <PHNUMBR2></PHNUMBR2>
        <PHNUMBR3></PHNUMBR3>
        <FAXNUMBR></FAXNUMBR>
        <UpdateIfExists>1</UpdateIfExists>
        <RequesterTrx></RequesterTrx>
        <CCode></CCode>
        <USRDEFND1></USRDEFND1>
        <USRDEFND2></USRDEFND2>
        <USRDEFND3></USRDEFND3>
        <USRDEFND4></USRDEFND4>
        <USRDEFND5></USRDEFND5>
      </taCreateVendorAddress>
    </taCreateVendorAddress_Items>
  </PMVendorAddressType>
</eConnect>

 This creates the address as shown in the screenshot below:

 

 So now we want to update this address.  We no longer want the XYZ Building line in the address and so change address lines in the above xml document to be:

        <ADDRESS1>Unit 42</ADDRESS1>
        <ADDRESS2>100 Main Street</ADDRESS2>
        <ADDRESS3></ADDRESS3>

Note: We also have the element <UpdateIfExists> set to 1, so it can both create and update addresses.

After importing the update XML document our address looks like the screenshot below: 

As you can see, the Address Line 3 has not been cleared from its previous value. The reason is that the eConnect code only updates fields where a value is passed and we did not pass a value for that field.

One suggestion I have heard was to pass a space through for the <Address3> element, however the space is counted as white space and ignored.

Below are two solutions. The first is the method which has been suggested in the past and the second is a much simpler solution that works well.

 

Solution 1: Custom Post Stored Procedure

This solution use the Post Custom Procedure to update the Address Line 3 when a special token value is passed updated on the field. So we will use the string "[Blank]" to signify that we want this field to be blank.

We then modify the taCreateVendorAddressPost stored procedure by adding the following update statement just before the return (@O_iErrorState) statement.

update PM00300 set ADDRESS3 = ''
where VENDORID = @I_vVENDORID and ADRSCODE = @I_vADRSCODE
and ADDRESS3 = '[Blank]'

So when we import the xml with the address lines as shown below, the custom post procedure will clear Address Line 3 for us.  

<ADDRESS1>Unit 42</ADDRESS1>
<ADDRESS2>100 Main Street</ADDRESS2>
<ADDRESS3>[Blank]</ADDRESS3>

 

Solution 2: Using CDATA to pass a space 

This solution was suggested by my colleague Allan Cahill and is even simpler, it does not need any custom stored procedures. It works on the idea of passing a space character to stored procedure in such a way that it is not ignored as white space. Using the syntax <![CDATA[ ]]>, we can pass the space through. This will update the Address Line 3 field with a space, but as Dynamics GP automatically strips leading and trailing spaces, this will be the equivalent of a blank or empty field. Below is the address lines from the XML document:

<ADDRESS1>Unit 42</ADDRESS1>
<ADDRESS2>100 Main Street</ADDRESS2>
<ADDRESS3><![CDATA[ ]]></ADDRESS3>

For more information on this method have a look at Chris Roehrich's post: Serializing CDATA tags in eConnect XML Documents.

 

Result

Both of these solutions work, you can decide which one is best for you. The screenshot below shows the updated address field with Address Line 3 now blank:

 

Hope this information is useful to you.

David

eConnect 10 SP4 "Access is denied" error

$
0
0
When trying to install eConnect 10 Service Pack 4 on a Windows Server 2008 R2 server, the service pack install started, but before it completed, I received the following error message:



Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))


Since this was on a Server 2008 machine, I immediately suspected that User Account Control was causing the issue.

So I tried right clicking on the service pack file so that I could select the deliciously omnipotent "Run as Administrator" option...but...

Heavens to Murgatroyd! The Run as Administrator was not listed when I right clicked on the ".msp" service pack file. Lovely. I'd seen this before, but forgotten about it.

Fortunately, like all good security measures, there's no need to kick down the front door when there's a rickety screen door in back.

So I then found my good buddy the Command Prompt icon in the Start Menu and right clicked on it, and then selected Run as Administrator.



With my fancy new C prompt, I then did a 'cd' over to the directory containing the service pack, typed in the name of the msp file, and it finally obeyed. The installation went fine from there.

eConnect Integration Service for Microsoft Dynamics GP 2010


eConnect Help Online

$
0
0

I spend an amount of time advising people to 'read the manual' when they write in with questions. The eConnect docs are not perfect, but you should have no problem getting started if you spend a few minutes reading. Better (IMHO) that asking someone else to do your work for you.

I'm not even sure that some of the new users have the help file, or know where it is. (You'd think they would, but...)

So, to that end, we've published the eConnect help file online here: http://vstoolsforum.com/econnecthelp/

 

Populate Rounding Account On Multicurrency Payables Transactions Created Via eConnect

$
0
0
If you create multicurrency payables (PM) transactions using eConnect, and you are passing in the distributions manually (by setting CREATEDIST to 0), you may have encountered the same issue I encountered today. When the transaction was created, eConnect also (correctly) added in a ROUND distribution, to account for 0.01 cents worth of FX related rounding […]

Sending XML Files to eConnect

$
0
0
I have been working on an eConnect integration that needs to import up to 40,000 sales transactions a day into Dynamics GP 9.

The challenge is that the data is coming from an off-site eCommerce web site, so we had to export the data from the web site so that we could transfer the data for import to GP.

After considering the pros and cons of CSV and XML, we chose XML because we thought that it would be easier to use XML to handle the header, lines, taxes, and payments in one file rather than having to deal with multiple CSV files. In this respect, we were right--it is easier to have one XML file to process vs. four CSV files. But in other respects, most of which I didn't anticipate, sending XML files to eConnect has some challenges.

When the client offered to prepare and export the XML files for me in the eConnect format, I thought it was great, since it would save me time--I would only need to read the XML file and just pass it over to eConnect. Simple, right? Famous last words.

It turns out, that for this project, importing XML files was moderately complex and posed some challenges.

My first challenge was trying to validate the structure of the XML file, which the client was creating. Normally the XML would be created by the eConnect .NET Serialization assemblies, in which case you never have to worry about the physical format of the XML file. But when the XML is being created by another system, I thought it would make sense to try and validate the format before import.

I thought this would be pretty straightforward, since eConnect provides XSD files that you can use to verify your XML files. After hours of trying to get the XSD validation to work, and a few posts to the great gurus at Experts Exchange, I realized that the XSD validation process was surprisingly impractical and was useless for my project. The eConnect XSD files utilize a few options that make the validation so rigid that I was unable to use it. And more surprising, because of the way XSD validation is performed, the process only returns one error at a time. In XML files with 2,000 to 4,000 transactions each , validating and fixing the XML file format one error at a time was impossible. I ended up just sending the XML file to eConnect and using those more informative errors to get the XML file format correct.

Next, I had to be absolutely sure that eConnect would accept and process XML files with multiple transactions. Processing 40,000 transactions a day using individual transation files was completely impractical, so we really needed to be able to send at lesat several hundred transactions in each file. I thought it would be possible, but with eConnect, until I see it working, I don't make any assumptions. And I also didn't know how sending large files to eConnect would affect the performance of the integration. Fortunately, once we worked out all of the kinks in the XML format, I was able to send a single XML file with 2,000 transactions to eConnect and all of the invoices were created successfully. I have since been able to send a single SOP invoice file with 4,700 transactions and have it import successfully. (see caveat below)

And of course, there is data validation. When you send a single file with thousands of transactions to eConnect, a single data error in that file will cause the entire file import to fail. So it is critical to validate the file thoroughly before attempting to import it, checking most of the node values to confirm that they will not cause a failure. I am validating customer IDs, item numbers, item types, SOP types, transaction dates, document subtotals vs. line totals, and tax IDs. I also have to make sure that the items have valid price lists, item site records exist, and that the ship method is valid. Fortunately this is easy to do with XML and the validation is fairly fast.

And then came the dreaded eConnect "System Error" messages. I haven't run into it this error yet with eConnect 10, but it is definitely an issue in GP 9. A System Error is returned by eConnect for various reasons, but unfortunately eConnect doesn't provide any additional information, so you have to determine the cause through guessing and trial and error. The most common reason for the eConnect System Error is that an XML node is missing. In some cases, nodes are only required under certain circumstances, so although the eConnect help file says that the node is optional, it may actually be required for your particular transaction scenario. So after hours of testing and troubleshooting, we were finally able to identify the cause of the System Errors. In some cases, a node was missing, and in other cases, it was because some of the nodes were not in the exact order that eConnect exptected (XSD theoretically checks for this, but as I described, it just isn't practical).

So all is well and I'm able to process the large XML files on my development server. But when we deployed to the client's server, we received System Errors yet again. We are able to process small files (with 250 transactions) on the client server, but the file with 4,700 transactions fails. I guessed it was because of some slight configuration difference between the client's GP environment and mine, and that one or more transactions were causing the error.

So I wrote a new import routine that would take the single XML file and import each transaction individually. This way we could find the individual transactions that were causing the failure. Once we installed the new integration and tested it, to our surprise, all 4,700 individual transactions imported fine. Our only conclusion is that there must be something on the client's server that caused the large files to fail--a problem that I don't have on my development server. We don't yet know how many transactions we can include in a file, but we will be trying different file sizes to see what will work consistently.

Finally, while doing live imports, I discovered a new quirk of eConnect 9 that surprised me. After importing SOP invoices, we were importing SOP Payments (taCreateSopPaymentInsertRecord) from a separate file. My validation routine detected that there was one error in a file, but somehow the entire file imported successfully. A payment for an invoice that did not exist in GP was not rejected by eConnect. I then created a test payment XML file with a fake customer and fake invoice number. Sure enough, eConnect procesed it without returning any errors--but of course the payment record did not appear in GP. Clearly eConnect 9 has a hole here.

So that's a summary of my adventures. Now that I've been through it, if I had a choice, I would generally not recommend trying to create XML files outside of GP and send them to eConnect. It's tedious, time consuming, and error prone to reverse engineer the eConnect XML format. It is so much easier to use the .NET eConnect Serialization assemblies than to debug and validate XML files. But as this project demonstrated, sometimes the choices are limited, and you just have to go off-roading and figure out new solutions.

eConnect 10.0 SP4 - Bug in taPOLine Schema

$
0
0
This one is pretty important.

I was reading thru' the GP Partner Forum and learned that PO Integrations using eConnect 10.0 SP4 fails with the message: Microsoft.Dynamics.GP.eConnect: Number = 8701 Stored Procedure taPoLine : Description = Document Date is required for PA

Original Link: eConnect failure in integration manager taPOLine.

MSFT responded back saying that this is a bug and will be rectified in the coming Hot Fix.

So those who are updating eConnect 10.0 to SP4, kindly be informed about this and make sure that you are keeping track of the Hot Fixes which MSFT is going to release in future.

VAIDY

Checking eConnect Version Number Programmatically

$
0
0
Lately, it seems that every time I deploy an eConnect integration, I run into some type of version issue with eConnect. The client will have 9.02 installed and I developed with 9.03, or 10.00 vs. 10.03. I often forget to ask in advance, and even if I do, nobody knows or remembers what version is installed. And when the wrong version is installed, the errors that I've run into seem to be completely random and inexplicable.

Based on these experiences, I figured it might be interesting to add a routine to my integrations to verify that the proper version of eConnect is installed before it attempts to run.

So today I decided to trace the "eConnect Release Information" utility to see how it was checking the eConnect version.

Turns out that it is just calling a single stored procedure:

exec DYNAMICS..taeConnectVersionInfoDYNAMICS

This returns a result set with 3 fields, with a row for each company:

Database Name
Version
CompanyName

I have verified that this procedure is available with eConnect 9 and 10, and from what I have read, may go back to version 7 / 7.5.

One good thing about the stored procedure is that it returns a "friendly" version number, like 9.0.3.0, 10.0.2.0, etc.

The stored procedure is encrypted, and I haven't bothered to buy a decryption app, so I can't tell exactly what it is doing, but I do know that it is iterating through each company database and checking something in the database.

The reason I know this, and the unintended consequence of this design, is that if there are any company databases that are Offline, or otherwise inaccessible, the version check fails completely and does not return any results. I have a client with over a dozen company databases, and several off line, so I'm unable to use the Release Information to check their eConnect version. Not very graceful.

And since this is only a stored procedure and is returning a version per company database, I assume that it is not checking the versions of the eConnect .NET DLL files.

If you want to check the DLL versions, you have a few options, but none are terribly appealing for programmatic checking.

1) The Knowledge Base recommends using Control Panel -> Add/Remove -> Select eConnect -> Click on Support Information link.

2) If you are adventurous, that same Add/Remove information can be found in the registry. Though it appears the GUID is the same across eConnect 10 releases and service packs (3C90E5C5C8D49BD42A1B7F8FF2B481C4), I suppose it could change at some point.

3) You can write code to locate the eConnect DLL and use FileVersionInfo to get the version number via .NET. The challenge is searching for the file on multiple drives and directories on a server.


And there are probably a few other creative ways I don't know about, like somehow checking the version in the .NET GAC.

The annoying part of checking the file versions is that it returns the typical useless GP version numbers like 10.00.0836.00 and 10.00.1072.00. Though documentation of such numbers is available for GP service packs, I haven't found such a list for eConnect service pack version numbers. If you know which version you want, you can just check to see if it matches, but I would rather be able to have a simple dialog that says "eConnect 10 SP2 is installed, but SP3 is required".

For now I think I'll try the stored procedure approach.

Dynamics GP Integrations using Integration Manager, Table Import, eConnect and Web Services

$
0
0

Getting started with GP Integrations?

If you are getting started with Integrations check out these posts - Sandip Jadhav - Types of Integration methods with Dynamics GP, which gives you a brief sneak-peek about the 8 tools available with GP for Integration. Integrating to Dynamics (GP) The Basics by the Touchstone guys. In this post they explain the first question that gets asked is “what is the best way of integrating?”and several ways of finding what tables do you need to integrate to?

There’s also a nice post - Integration - All About Attitude by the nice people at Rose Business Solutions. Steve Endow has a post on "Real Time" Dynamics GP Integrations in which he discusses the steps to create a “real time” integration between Dynamics GP and another system.

Other posts worth highlighting are Integration to Concur Travel & Expense by Geoffrey Wayong, also covered by the Dynamics GP Team at NEW Integration Capabilities with Concur Travel & Expense! 

Related categories on GPWindow are DEVELOPMENT which includes – Dexterity, Developer Toolkit, GP SDK, Tables Information, Testing, VBA and VS Tools for GP and CUSTOMIZATIONS which covers – modifier, Extender and Macros.

eConnect

Steve Gray says - “I spend an amount of time advising people to 'read the manual' when they write in with questions.” and points us to the - eConnect Help Online.

Also in the eConnect sub section, you can view posts regarding using eConnect to get data into Dynamics GP with some examples. eConnect Integration Service for Microsoft Dynamics GP 2010 by Mariano Gomez contains information about eConnect 2010 and how it is better than its predecessors. There other detailed posts by Steve Endow with his troubleshooting notes - More than I ever wanted to know about eConnect and MSDTC and Troubleshooting eConnect "System Error" Message. Steve also shares some performance benchmarks of eConnect in the post eConnect Performance Benchmarks.

Mariano covers Retrieving Microsoft eConnect 10.0 Version and Steve has a post on Checking eConnect Version Number Programmatically.

You can also find some examples to use eConnect to get data into GP from Steve like Using eConnect to import Inventory Adjustments with Multi-Bin, Clearing Existing Field Values Using eConnect, eConnect Bank Transaction Import.

From Sage, Quickbooks, Peachtree

You should definitely check out the posts in the Rapid Migration and Implementation Tools if you are working on bringing customers from one of these accounting systems.  The free tools from Microsoft make migration a snap, and will save you a lot of time.

In addition to that, In the From Sage, Quickbooks, Peachtree sub section, you will see posts related to migration and other news from other Accounting Systems like Sage, Quickbooks and Peachtree into Dynamics GP. Check out the posts - Helping Peachtree customers make a “Smart Move”… 

Integration Manager

Version Information : First off, a couple of posts to bookmark –VictoriaYudin shares Dynamics GP Integration Manager versions and Mariano has the GP 10 Service Pack versions here - IM - Integration Manager Service Packs.

Downloads : You can find IM Downloads here - Integration Manager Downloads 

Information :  If you are looking to get started with Integration Manager this post by Q Factor Integration Manager: The Basics will give you all the basic details about the product.

There are loads of useful posts by MVP Mariano Gomez like one on Integration Manager 10 INI settings and Copying an Integration in Integration Manager to copy an integration into another integration, How to schedule Dynamics GP to automatically log in and run an Integration Manager integration in cases where you want Integration Manager to run automatically at night and bring in data from another system, Sorting Records in Integration Manager v10 to sort the records as they appear on your import file by changing IM ini settings.

Mariano also covers - IM - How to group Integration Manager transactions based on transaction date, How to import the Vendor 1099 Box with Integration Manager and How to filter source query records dynamically. Mariano also has a nice article on MSDynamicsWorld - "Putting to Rest Four Myths About Microsoft Dynamics GP Integration Manager". Mariano also explains the Supported Date Formats in Integration Manager and then goes on to detail out the steps for Dropping Timestamps from SQL Server and Text File Data Sources in Integration Manager, where he discusses two methods (SQL Query and VBScript).

MVP and bestselling author Mark Polino has a lot of nice articles on Integration Manager covered in his Weekly Dynamic feature -

In the Integration Manager sub section, you will also see posts related to using Integration Manager to bring data (Journal entries, Payables Invoices, Sales Invoices, Bank Transactions etc.) into Dynamics GP.

There’s a post by Mohammad R Daoud that explains how to Import Transactions Distributions Using Integration Manager. There is also a great posts on Integration Manager and ODBC by Rose Business Solutions.

Errors and Troubleshooting : Steve Endow talks about Integration Migration Frustration and shares his - “integration review template" to help me try and detect some of these issues in advance next time.”Steve also has the Integration Manager 10 Bugginess: Data Sources, Relationships, and Scripts post where he discusses the Relationships feature. Mark Polino also shares his Integration Manager Rant.

If you using Integration Manager on a terminal server you might find the post Integration Manager 10 : Changing the path of IM Database for a User useful, and if you are using IM 2010 you would want to check out the Integration Manager with GP 2010 Error post.

Waqas has a nice post on Integration Manager 10– Debugging Integration Error and Daoud explains how you can keep Microsoft Dynamics GP visible when running Integration created by Integration Manager and watch the transactions pushed inside GP windows a record after record

Check out other posts directly at Integration Manager section on GPWindow.

Table Import

In the Table Import sub section, you will find some nice posts about GP’s Table Import functionality. This wonderful post by Mariano Gomez The often overlooked, yet powerful Table Import will get you started with Table Import and show you an overview of Table Import feature and an example to import a few customers using a tab-delimited file. Christina has the interestingly yet aptly title post - Table Import is not always the ugly stepsister. Mark covers this in his Weekly Dynamic Weekly Dynamic: Table Import.

Webservices

GP Webservices are where the future of Dynamics GP Integrations lies. Performance benchmarks are now carried out keeping this is mind. In the Webservices sub section, you will find posts about the introduction of GP Webservices, installation of Dynamics GP Web Services, issues faced while installing Webservices and uninstalling GP web services completely.

There’s a nice post by the DynGp Team - Microsoft Dynamics GP 2010 Web Services that will get you started with Dynamics GP Webservices 2010.

Then there’s this nice article by Steve Gray that has the Code to call a web service method. Steve covers Formatting Note Lines with GP Web Services. Chris Roehrich at Developing for Dynamics GP provides some awesome code on How to retrieve Quantity On Hand amount using Web Services for Dynamics GP 10.0 and discusses the Web Services Configuration Settings for Integrating Large Transactions.

Some of these posts point out some common problems that you may face while installing Dynamics GP web services on the GP server - Web Services Install: Fatal Error during Installation by Janakiram , Dynamics GP Web Service Installation Error by Sandip Jadhav. Sandip in this another post that tells us on How to Remove Dynamics GP Web Service completely.

-------------------- Via http://www.gpwindow.com/INTEGRATIONS_/

Are there any articles related to the topics above that I missed ? If yes, add your comments.

Using eConnect to import Inventory Adjustments with Multi-Bin

$
0
0
I recently fielded a question on the GP Developer newsgroup about an eConnect error that occurred when trying to import inventory adjustments with multi-bin.

The developer was able to import positive inventory adjustments, but negative adjustments would fail with this error:

The QTY entered has to be > 0

After poking around in the GP Item Transaction Entry window, I found the inconsistency that was causing the problem.

The Item Transaction Entry window is one of the few places in GP where you can enter a negative quantity. I admit that I truly enjoy being able to type a negative number in the Quantity field, since it's such a rare treat in GP.



The negative quantity is convenient and logical for decreasing inventory quantities; however, it is not necessarily consistent with the rest of GP, and when it comes to the Bin Quantity Entry window, GP suddenly reverts to the typical positive-only behavior.



In the Bin Quantity Entry window, you must enter a positive value in the Quantity Selected field, even though the transaction is a negative inventory adjustment. Yet there isn't any field or option on the Bin Quantity Entry to specify increase or decrease.

Once you insert the bin and quantity selection, note that the Extended Quantity is negative, but the Selected Quantity is positive.



This is a pretty poor, inconsistent design that can cause confusion in both the GP user interface, as well as the eConnect API.

If you look at the eConnect documentation for the taIVTransactionMultiBinInsert node, you'll see a node called ADJTYPE, which can be 0=Increase or 1=Decrease. Why this exists in eConnect but not in the GP user interface, well, I'll leave that for others to ponder.

So to summarize, when you import a negative inventory adjustment via eConnect using multi-bin, you have to first create a negative inventory adjustment, then you have to create a positive multi-bin record, and then you also have to specify that the multi-bin record is a Decrease adjustment. Obvious, right?

Why the Bin quantity entry window (and taIVTransactionMultiBinInsert) accepts only positive values for a negative inventory adjustment is yet another historical GP mystery that I'm sure has some highly rationalized explanation, but for now I'm going to chalk it up to them wanting to keep us on our toes.

Troubleshooting eConnect "System Error" Message

$
0
0
Over the last several months, I have developed several eConnect integrations for a client. The integrations work fine on my development machine, but sometimes when the integrations are run on the client server, eConnect generates errors and simply returns the text "System Error", with no additional detail.

After much poking around, I discovered that in general, this is often caused by a required eConnect field that is not being populated when the data is sent to eConnect. But other times, I have been unable to explain why the System Error is occurring.

I thought I had searched the GP Knowledge Base previously to see if there was any reference to these frustrating "System Error" messages, but today, after yet another error, I decided to check the KB again.

Sure enough, there is KB article 943133 that discusses the System Error. Not sure why I didn't see it earlier.

It appears that I used an older copy of my .NET class that calls eConnect. I had a catch block for an eConnectException and a generic Exception, but not for a SqlException.

I know that Steve Gray has pointed this out on his excellent eConnect forums, so I knew that any call to the eConnect_EntryPoint should have all three catch blocks, but I just didn't have the SqlException catch block in my code for this client, and it didn't dawn on me that this is why I only received "System Error" with no additional detail.

I take the blame for this oversight, but I don't think the errors are all my fault. The client does not have the latest release of eConnect 9 installed, so it does seem that eConnect 9.0.1 does have some flaws. Instead of returning errors for certain field level issues in the XML data, it seems to miss these errors and attempt to send the XML off to the SQL stored procedures, which is why the SqlExceptions are being thrown.

Running the exact same .NET integration with the same source data on eConnect 9.04 on my server does not generate any errors, so my guess is that these are quasi-bugs in eConnect 9 that have been resolved in service packs.

So lesson #2 is to make sure to install eConnect service packs!

And with that, I return to the pouring rain here in Los Angeles...

eConnect Integration Service for Microsoft Dynamics GP 2010

$
0
0
One of the biggest improvements in eConnect 2010 is the addition of the new eConnect Integration Service. The eConnect installer now creates a new Windows Service application named eConnect for Microsoft Dynamics GP 2010 integration Service. The eConnect Integration Service is a Windows Communication Foundation (WCF) service that replaces the (very unstable) eConnect COM+ object available in previous versions of eConnect.

The eConnect Integration Service supports the operations of the eConnect .NET assemblies, the BizTalk adapter, and MSMQ interfaces. In addition, you can use the service directly from an application that adds a service reference to the eConnect Integration Service.




If you add a service reference, you do not need to add the Microsoft.Dynamics.GP.eConnect assembly and namespace to your development project.



To add the eConnect Integration Service to an application, you must first add a service reference to the Visual Studio project for that application.

To add a service reference to a Visual Studio project, the properties for the project must specify the target framework as .NET Framework 3.5. The following is a typical URL for the eConnect Integration service.

net.pipe://localhost/Microsoft/Dynamics/GP/eConnect/


The interface provided by the service reference includes the same methods you find in the Microsoft.Dynamics.GP.eConnect assembly and namespace. Before you use a service reference to access eConnect Integration Service, you should become familiar with WCF development concepts.

Until next post!

MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/

Microsoft Dynamics 10 eConnect C# 4.0 .NET Serialization In Memory

$
0
0

I was recently tasked with creating an eConnect integration between Microsoft Dynamics GP 10 and a custom SharePoint 2010 Portal designed to replace the GP Item Maintenance process with workflow and departmental routing.

Most of the eConnect examples I see online serialize the eConnect object to a file before loading it into an XmlDocument. This can cause unnecessary permissions concerns, and worse, if your application runs under the context of IIS or SharePoint you may not have a file system available to you at all. This was the case in my scenario. A much better approach is to serialize the object in memory.

Below is an example of eConnect serialization in memory using Microsoft C# .NET 4.0.

Assuming you have already installed the eConnect SDK 10, reference the following assemblies:

Microsoft.Dynamics.GP.eConnect.dll
Microsoft.Dynamics.GP.eConnect.MiscRoutines.dll
Microsoft.Dynamics.GP.eConnect.Serialization.dll
System.EnterpriseServices.dll

And add the following using statements:

using System.IO;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Dynamics.GP.eConnect;
using Microsoft.Dynamics.GP.eConnect.Serialization;
Here is the code to serialize the eConnectType object in memory and load it into an XmlDocument which is then passed to the eConnect_EntryPoint method:


string connectionString = string.Empty; // Set up a valid connection string.

eConnectMethods econnectMethods = neweConnectMethods();
eConnectType eConnectType = neweConnectType();

// Instantiate and populate the specific eConnect types needed.
// Don't forget to add them to eConnectType once they are set up.

// We're done building the object model, now serialize it in memory.
MemoryStream memoryStream = newMemoryStream();
XmlSerializer xmlSerializer = newXmlSerializer(eConnectType.GetType());
xmlSerializer.Serialize(memoryStream, eConnectType);
memoryStream.Position = 0;

// Create a new XmlDocument from the in memory serialized object model.
XmlDocument xmlDocument = newXmlDocument();
xmlDocument.Load(memoryStream);
memoryStream.Close();

econnectMethods.eConnect_EntryPoint(connectionString, EnumTypes.ConnectionStringType.SqlClient, xmlDocument.OuterXml, EnumTypes.SchemaValidationType.None, string.Empty);

Hope it helps!


http://mbsguru.blogspot.com/atom.xml

How to Serialize eConnect XML - Properly

$
0
0
I'm posting this for my own reference because I can never remember the full syntax and I regularly have to look it up.

I think I've seen at least 3 or 4 different code samples showing how to serialize eConnect XML in .NET.

One version, which I think is actually based on sample eConnect code that Microsoft provided years ago, writes the XML out to a file on the hard drive, then reads it back into memory.  The first time I saw this my eyes rolled in disbelief.  Clearly that is a terrible idea and is completely unnecessary.

The other versions, which I have used over the last few years, used in-memory techniques to serialize the XML using a combinations of a MemoryStream, XmlTextReader, and StringBuilder.  Although these worked fine, the process to use an XmlTextReader and StringBuilder never seemed ideal.

The best example I've seen so far is the one that Brian Prince posted on the MBS Guru blog back in December 2010.  The XML Document approach is simple and very clean, and it is the technique I've been using ever since he wrote about it.

Here is Brian's approach:

MemoryStream memoryStream = newMemoryStream();
XmlSerializer xmlSerializer = newXmlSerializer(eConnectType.GetType());
xmlSerializer.Serialize(memoryStream, eConnectType);
memoryStream.Position = 0;

XmlDocument xmlDocument = newXmlDocument();
xmlDocument.Load(memoryStream);
memoryStream.Close();

econnectMethods.eConnect_EntryPoint(
connectionString, EnumTypes.ConnectionStringType.SqlClient, 
xmlDocument.OuterXml, EnumTypes.SchemaValidationType.None,  
string.Empty);


Steve Endow is a Dynamics GP Certified Trainer and Dynamics GP Certified IT Professional in Los Angeles.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

http://www.precipioservices.com

eConnect 2010 Error: There was no endpoint listening at net.pipe

$
0
0
If you are working with eConnect 2010, you may run into the following error at some point:

There was no endpoint listening at net.pipe://localhost/Microsoft/Dynamics/GP/eConnect/EntityOperations that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

There are probably several possible causes of this error, but one of the simple causes is that the eConnect 2010 Integration Service is not running on your server.

On my GP 2010 server, it seems that the eConnect 2010 service installed with a Startup Type of Manual.  I installed it several months ago, but I don't recall changing the setting from Automatic to Manual.

In any event, if you notice that the "eConnect for Microsoft dynamics GP 2010 Integration Service" is not running, that would likely explain the "no endpoint listening" error that you are receiving.

Just start the eConnect 2010 Integration Service up, and then try your integration again.

If the Integration Service is running on your server, then you can check the Configuration.ServiceAddress value that you are using in your integration and confirm that you are using a valid URL.

Other than that, I'm going to be looking into the details of the protocols and ports required for the eConnect 2010 / WCF communication.  Since I ran into internal firewall issues with eConnect 10 and DTC, I want to be prepared for similar situations with eConnect 2010.

I'm in the process of migrating some GP 9 eConnect integrations to GP 2010, so I'll probably be learning more, and posting more, about eConnect 2010 in the near future.

Steve Endow is a Dynamics GP Certified Trainer and Dynamics GP Certified Professional.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

http://www.precipioservices.com
Viewing all 30 articles
Browse latest View live