Creating an eConnect document for a .NET project

The serialization classes enable you to use .NET to create an object that represents an eConnect XML document. The following sections show how to use the serialization classes to construct a document object. You typically use these objects with the the Create, Update, or Delete method of the eConnectMethods class.

To create an eConnect document object using serialization classes, complete the following steps.

Create an eConnect node object

To begin, use the serialization classes to instantiate the objects that represent the XML nodes for your type of transaction and operation. Populate the fields of the object with the data values you want to use.

The following Visual Basic example shows how to instantiate a taSopHdrIvcInsert object. Notice how the fields of the object are populated with data values:

Dim salesHdr As New taSopHdrIvcInsert

With salesHdr
	.SOPTYPE = 3
	.SOPNUMBE = "INV2001"
	.DOCID = "STDINV"
	.BACHNUMB = "eConnect"
	.TAXSCHID = "USASTCITY-6*"
	.FRTSCHID = "USASTCITY-6*"
	.MSCSCHID = "USASTCITY-6*"
	.LOCNCODE = "WAREHOUSE"
	.DOCDATE = DateString 'Today
	.CUSTNMBR = "CONTOSOL0001"
	.CUSTNAME = "Contoso, Ltd"
	.ShipToName = "WAREHOUSE"
	.ADDRESS1 = "2345 Main St."
	.CNTCPRSN = "Joe Healy"
	.FAXNUMBR = "13125550150"
	.CITY = "Aurora"
	.STATE = "IL"
	.ZIPCODE = "65700"
	.COUNTRY = "USA"
	.SUBTOTAL = 53.8
	.DOCAMNT = 53.8
	.USINGHEADERLEVELTAXES = 0
	.PYMTRMID = "Net 30"
End With

Create an eConnect transaction type object

An eConnect XML document uses transaction type schemas to group related nodes for a specified operation. To perform this step, you instantiate a transaction type object. You then populate the fields of the transaction type object with node objects for that specified transaction type.

The following Visual Basic example shows how to instantiate a SOPTransactionType object. Notice how the taSopHdrIvcInsert field is populated with the salesHdr object from the the previous step:

Dim salesOrder As New SOPTransactionType

salesOrder.taSopHdrIvcInsert = salesHdr

Create an eConnect document object

An eConnect XML document uses a document node to package transaction types for the eConnect business objects. To perform this step in .NET, you instantiate an eConnectType object. You then populate the fields of the document object with your transaction type objects.

The following Visual Basic example instantiates an eConnectType object. Notice how the SOPTransactionType field is populated with salesOrder object from the previous step:

Dim eConnect As New eConnectType

eConnect.SOPTransactionType = salesOrder

Serialize the eConnect document

To use or store your .NET eConnect document object, use the .NET XmlDocument and XmlSerializer classes to convert the .NET document object into an eConnect XML document. You typically serialize your .NET document for the following scenarios: