Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

EConnect Basics

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

eConnect Basics

Incoming Integrations

Incoming integrations refer to any integration where data is moved into Microsoft
Dynamics GP. There are several ways to integrate data into Microsoft Dynamics
GP using eConnect:

Pass an XML document to the eConnect .NET Assembly.

Put an XML document on a queue and have the Incoming Service process
the document.

Send an XML document to BizTalk and have BizTalk process the document
by using the eConnect adapter.

An Incoming service is included with eConnect and can be used to pull documents
off a queue and push them directly into Microsoft Dynamics GP by using the
eConnect API. This means that all that you must do is create XML documents in
the correct format and then put them on a queue. The Incoming Service picks the
XML document off the queue, validates the document, and then creates the
appropriate record in Microsoft Dynamics GP.
Incoming Integrations (Part 2)

The Incoming Service installation includes an eConnect_Incoming.exe.config file. This


file is an XML configuration document that contains setup and specification rules for
the Incoming Service. By default, this configuration file is created at the following
location:
C:\Program Files\Common Files\Microsoft Shared\eConnect10\Services\Incoming
Service
You must modify the eConnect_Incoming.exe.config file after the service is installed.
One key that must be modified is the eConnect.BackOffice.ConnectionString key.
Change the key to represent the connection string for the Microsoft Dynamics GP SQL
Server.

Assembly

Description

Microsoft.Dynamics.GP.eConnect.dll

Contains the eConnectMethods class that is


used by applications to pass in and request
data from Microsoft Dynamics GP.

Microsoft.Dynamics.GP.eConnect.MiscRout
ines.dll

Used to create Customer specific pricing and


to retrieve the next sales order number based
on setup information.

Microsoft.Dynamics.GP.eConnect.Serializat
ion.dll

Used for serializing data into XML format based


on an eConnect schema which can be passed
with either the eConnect COM or .NET
Assembly.

Add a Reference

Add a reference to the assemblies by following these steps:


1.

In Visual Studio 2005, with the application open, click Project, and then click
Add Reference.

2.

Click the Browse tab and locate the assemblies. By default this location is:
C:\Program Files\Common Files\Microsoft Shared\eConnect 10\Objects\Dot Net

3.

Select the assembly to reference and then click OK.

Microsoft.Dynamics.GP.eConnect Assembly
Class

Description

eConnectMetho
ds

Sends and receives eConnect XML documents.

EnumTypes

Enumerates the types that are used as parameters with the


eConnectMethods class.

eConnectExcepti
on

Catched eConnect specific error messages.

eConnectMethods Class
Method

Type

Description

eConnect_EntryPoint

Public

Submits an XML document.

eConnect_Requester

Public

Retrieves data from Microsoft Dynamics GP.

SchemaValidationType enumeration in the eConnect_EntryPoint

Type

Value

Description

None

No validation is performed.

XSD

Use an .xsd file for validation.

ConnectionStringType enumeration
Type

Value

Description

SqlClien
t

The connection string is for Microsoft SQL Server.

OleDB

The connection string is for a database server that supports ODBC


connections.

eConnect_EntryPoint method
//C#
eConnectResult = eConnectObject.eConnect_EntryPoint(ConnectionString,
EnumTypes.ConnectionStringType.SqlClient, xmlDoc.OuterXml,
EnumTypes.SchemaValidationType.None);
Parameter

Data Type

Description

ConnectionSt
ring

String

Specifies the data


server and
database.

ConnectionTy
pe

Microsoft.Dynamics.GP.eConnect.EnumTypes.Connectio
nStringType

Use the
ConnectionStringT
ype enumeration
member that
specifies the data
server type.
ConnectionStringT
ype includes the
following
members:
SqlClient
OleDB

sXML

String

An eConnect XML
document.

ValidationTyp
e

Microsoft.Dynamics.GP.eConnect.EnumTypes.SchemaV
alidationTypes

Use a
SchemaValidation
Type enumeration
member to
specify the type
of data validation
to perform.
SchemaValidation
Type includes the
following
members:
None

XSD
eConnectSch
ema

string

Optional. If you
set the
ValidationType
parameter to use
XSD validation,
you must specify
the .xsd file that
contains the
schema
definition.

eConnect_EntryPoint Method (Part 2)

If Schema Validation is used and fails, an error similar to the image may be returned at
runtime.

//C#
//Create an XML Document object for the schema
XmlDocument XsdDoc = new XmlDocument();
//Default path to the eConnect.xsd file
//Change the filepath if the eConnect 10.0.0.0 SDK is installed in a location
//other than the default.
XsdDoc.Load(@"C:\Program Files\Common Files\Microsoft Shared\eConnect 10\XML Sample
Documents\Incoming XSD Schemas\eConnect.xsd");
string sXsdSchema;
//Create a string representing the eConnect schema
sXsdSchema = XsdDoc.OuterXml;
eConnectResult = eConnectObject.eConnect_EntryPoint(ConnectionString,
EnumTypes.ConnectionStringType.SqlClient, xmlDoc.OuterXml,
EnumTypes.SchemaValidationType.XSD, sXsdSchema);

eConnect_Requester Method

The eConnect_Requester method is part of the eConnectMethods


class in the Microsoft.Dynamics.GP.eConnect namespace. A sample
for this method is as follows:

//C#
ReturnData_TextBox.Text=eConnectObject.eConnect_Requester(Co
nnectionString, EnumTypes.ConnectionStringType.SqlClient,

xmlDoc.OuterXml);
Parameter Data type
ConnectionStr String
ing

Description
Specifies the
data server and
databases.
ConnectionTy Microsoft.Dynamics.GP.eConnect.EnumTypes.ConnectionStrin Use the
pe
gType
ConnectionString
Type
enumeration
member that
specifies the
data server type.
ConnectionString
Type includes the
following
members:

sXml

String

SqlClient
OleDB
An eConnect XML
document.

eConnectException class
//C#
//If an eConnect error occurs, display the error message
catch (eConnectException eConnectError)
{
ReturnData_TextBox.Text = eConnectError.Message;
}
//If an unexpected error occurs, display the error message
catch (Exception ex)
{
ReturnData_TextBox.Text = ex.Message;
}

Microsoft.Dynamics.GP.eConnect.MiscRoutines Assembly
Class

Description

GetNextDocNumb
ers

Gets the next available number for several types of Microsoft Dynamics
GP documents.

GetSopNumber

Retrieves a SOP number for a sales document. This class also allows
you to return a SOP number that was retrieved but not used.

PricingMethods

Retrieves customer specific pricing.

EXAMPLE CREATING A NEW VENDOR

//C#
private void btnCreate_Click(object sender, EventArgs e)
{
try
{
StringBuilder xml = new StringBuilder();
xml.Append("<eConnect>");
xml.Append("<PMVendorMasterType>");
xml.Append("<taUpdateCreateVendorRcd>");
xml.Append("<VENDORID>" + txtVendorID.Text.ToUpper() + "</VENDORID>");
xml.Append("<VENDNAME>" + txtVendorName.Text + "</VENDNAME>");
xml.Append("<VADDCDPR>" + txtAddressCode.Text + "</VADDCDPR>");
xml.Append("<VNDCNTCT>" + txtContact.Text + "</VNDCNTCT>");
xml.Append("<ADDRESS1>" + txtAddress1.Text + "</ADDRESS1>");
xml.Append("<CITY>" + txtCity.Text + "</CITY>");
xml.Append("<STATE>" + txtState.Text + "</STATE>");
xml.Append("<ZIPCODE>" + txtZip.Text + "</ZIPCODE>");
xml.Append("<PHNUMBR1>" + txtTelephoneNumber.Text + "</PHNUMBR1>");
xml.Append("</taUpdateCreateVendorRcd>");
xml.Append("</PMVendorMasterType>");
xml.Append("</eConnect>");
string connString ="Data Source=London; Initial Catalog=TWO; Integrated Security=SSPI;
Persist Security Info=False;";
eConnectMethods eConCall = new eConnectMethods();
bool status;
status = eConCall.eConnect_EntryPoint(connString,
EnumTypes.ConnectionStringType.SqlClient, xml.ToString(),
EnumTypes.SchemaValidationType.None, "");
if (status)
{
lblStatus.Text ="Document Successful";
lblStatus.Visible = true;
}
}
catch (eConnectException ex)
{
lblStatus.Text = ex.Message;
lblStatus.Visible = true;
}
}

Extend eConnect Business Logic

When building integrations, you may need to include additional business logic to solve
a specific business problem. Within eConnect, there are several methods that you can
use to add the appropriate business logic. You can add an additional XML node to the
existing XML schema and use custom pre- and post stored procedures.

Add Additional XML Nodes

eConnect allows you to add XML nodes to its document schema. Custom XML nodes
enable you to use custom data elements within an eConnect XML document. Use
custom data elements to provide additional data or to trigger custom business logic.
When eConnect processes an XML document, it maps the name of each XML node to a
SQL stored procedure. The following XML creates a node named
<eConnectCustomProcedure>:

<eConnectCustomProcedure>
<CUSTNMBR>CONTOSOL0002</CUSTNMBR>
</eConnectCustomProcedure>

When eConnect processes a document containing the eConnectCustomProcedure


node, it looks for a SQL stored procedure with the same name, in this case
eConnectCustomProcedure. You must create the eConnectCustomProcedure stored
procedure to handle your custom XML node.
To create a custom XML node you must:

Define the data elements of your custom XML node.

Provide each element with a unique name.

Add the XML node to an existing eConnect transaction type.

Use the eConnect XML document's <eConnectProcessInfo> node to control the stored
procedures' order of execution. To execute the eConnect core stored procedures prior
to any custom stored procedures, set the <eConnectProcsRunFirst> element to TRUE.
To execute custom stored procedures prior to the eConnect core stored procedures, set
<eConnectProcRunFirst> to FALSE.

You might also like