ECGrid Forums  

Go Back   ECGrid Forums > Electronic Commerce > ECGridOS > ECGridOS Developer

ECGridOS Developer Development related posts.

Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2010, 02:48 PM
Todd Gould's Avatar
Todd Gould Todd Gould is offline
Loren Data Corp.
 
Join Date: May 2005
Location: Loren Data Corp.
Posts: 303
Send a message via Skype™ to Todd Gould
Lightbulb Sample Code

If you want to share sample ECGridOS code, please post it here. The Loren Data development team will be posting, too.

-=tg=-
Reply With Quote
  #2  
Old 09-13-2010, 02:56 PM
Todd Gould's Avatar
Todd Gould Todd Gould is offline
Loren Data Corp.
 
Join Date: May 2005
Location: Loren Data Corp.
Posts: 303
Send a message via Skype™ to Todd Gould
Default C#.net sample

http://forums.ecgrid.com/showpost.php?p=460&postcount=4
Reply With Quote
  #3  
Old 09-13-2010, 02:59 PM
Todd Gould's Avatar
Todd Gould Todd Gould is offline
Loren Data Corp.
 
Join Date: May 2005
Location: Loren Data Corp.
Posts: 303
Send a message via Skype™ to Todd Gould
Default ECGridOS™ Sample Code

From http://ecgridos.net/docs/index.htm#p...ple%20Code.htm

Source files for all sample code can be found at http://ecgridos.net/docs/samplecode.zip.

Add a Trading Partner to the Global ECGrid Directory
This sample shows how to add a Trading Partner to the Session Network/Mailbox and to a VAN Network.

Search for a Trading Partner ECGridID by Qualifier/ID
Locate an ECGridID by the Trading Partner's Qualifier/ID pair.

Find a Trading Partner ECGridID by Description
Find a Trading Partner record by Description including wildcard.

Create an Interconnect
Request an Interconnect between two ECGridIDs.

Interchange Upload/Download
Upload files in a specified directory to the Session Network/Mailbox and Download all new Parcels in the Session Network/Mailbox to a specified directory.
Reply With Quote
  #4  
Old 09-13-2010, 06:58 PM
Todd Gould's Avatar
Todd Gould Todd Gould is offline
Loren Data Corp.
 
Join Date: May 2005
Location: Loren Data Corp.
Posts: 303
Send a message via Skype™ to Todd Gould
Default Adding ECGridOS Web Service to Visual Studio

The ECGridOS API is easily linked to Visual Studios by the following method. This is specific to VS2008, but should be easily adapted to other versions.
  1. Set up your project as desired in whatever language you choose.
  2. Either right click under Solution Explorer or from the menu select Add Web Reference.
  3. In the URL box use https://ecgridos.net/v2.2/prod/ECGridOS.asmx and click Go. (The version number may be different by the time you read this. Please check at http://ecgridos.net documentation for current version.)
  4. The default Web Reference Name is net.ecgridos, you can use that or change it to something else. Select Add Reference.

The above steps will link your project to the ECGridOS Web Services API. You will now have direct access to all the Class Objects, Enums and other features of ECGridOS right in your project.

You will need to create an instance of the web service object by a declaration such as:

Code:
Dim ecgridos As New net.ecgridos.ECGridOSAPIv2
This allows you to access the API through calls such as this:

Code:
Dim ErrorInfo As ErrorInfo 'see below SOAP Exceptions
Try
    SessionID = ecgridos.Login(LoginName,Password)
    Return True
Catch ex As SoapException
    ErrorInfo = CatchException(ex)
    Return False
End Try
Here is an example of having the API return a Array of ECGridIDInfo objects and turning it into a List(Of ..) object:

Code:
Public Function TPSearch(ByVal NetworkID As Integer, _
                         ByVal MailboxID As Integer, _
                         ByVal Qualifier As String, _
                         ByVal ID As String, _
                         ByVal ShowInactive As Boolean) _
                         As List(Of net.ecgridos.ECGridIDInfo)
    Dim l As New List(Of net.ecgridos.ECGridIDInfo)
    l.AddRange(ecgridos.TPSearchEx(SessionID, NetworkID, MailboxID, Qualifier, ID, ShowInactive))
    Return l
End Function
You never need to see or worry about XML except for parsing SOAP exceptions, and that is simple, too:

Code:
Public Class ErrorInfo
    Public ErrorCode As Integer
    Public ErrorString As String
    Public ErrorItem As String
    Public ErrorMessage As String
End Class

Public Function CatchException(ByVal ex As SoapException) As ErrorInfo
    Dim doc As New XmlDocument
    Dim Node As XmlNode
    CatchException = New ErrorInfo
    doc.LoadXml(ex.Detail.OuterXml)
    Node = doc.DocumentElement.SelectSingleNode("ErrorInfo")
    If Not Node Is Nothing Then
        CatchException.ErrorCode = CInt(Node.SelectSingleNode("ErrorCode").InnerText)
        CatchException.ErrorString = Node.SelectSingleNode("ErrorString").InnerText
        CatchException.ErrorItem = Node.SelectSingleNode("ErrorItem").InnerText
        CatchException.ErrorMessage = Node.SelectSingleNode("ErrorMessage").InnerText
    Else
        CatchException.ErrorMessage = ex.Message.ToString
    End If

End Function
-=tg=-
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:32 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
ECGrid® is a registered service mark of Loren Data Corp.