|
|
Using the Web Service with .NET (Visual Studio)
Continuing from the previous walk-through save the WSDL generated by right clicking
on WSDL Url link and save to a file.

Create a new Winform application in Visual Studio. Name the project WebServiceDemoClient.
Add a Web Reference to the project. In the URL specify the full path to
the WSDL file that you saved in the previous step and in the Reference name
enter SEF850 and press the Add Reference button.

You should see a Web References folder added to the project.

This step of adding a web reference is to generate and include the .NET class that
represents the 850 SEF file which is defined by an Xml schema, that is embedded
in the WSDL. The proxy functions defined in the WSDL are not to be called as they do nothing.
Next, we add another web reference to EDI web servic to http://www.edixmlonline.com/webservices/

You should see another web reference folder.

This step of adding a web reference is to generate and include the proxy class of
the actual web service that will generate and translate EDI files.
Layout the mainform to look like the following. The SEF ID should be the id created
for the SEF file you uploaded and wish to use in your application. And for this
example it was one that was created under the "demo" user and happens to be b5c0771a-ace2-436c-bb9e-e8ff98b2b042
.

Let's start adding code to the MainForm. First, add the necessary imports at the top of the class file.
We will add a private instance variable to the form and initialize a few in the
constructor of the form.
The OnClick event for the "Login" button looks like
The OnClick event for the "Generate EDI in code" button
looks like
The OnClick event for the "Translate EDI Text (Serialized Xml)"
button looks like
The OnClick event for the "Translate EDI File To XML"
button looks like
The OnClick event for the "Generate From XML To EDI"
button looks like
The OnClick event for the "Validate EDI Text"
button looks like
The OnClick event for the "Validate XML Text"
button looks like the one for the EDI except that it calls the "ValidateXml" service
operation.
Run the Application

Note
You will find that the raw Xml from the Translation service will not validate as
well as the Xml created from a serialized proxy object. This is because the serialized
xml is more complete and is dictated by the proxy class that was created based on
the rules defined in the schema information found in the WSDL. Whereas, the translation
service forumlates its xml reply based on the EDI payload and the rules defined
by the SEF file.
So, the raw xml file from the translation service is not an accurate representation
of EDI payload, you must deserialize it into a proxy object and interrogate the
properties of the object.
|
|