Web Services in Software Integrating PDF 417 in Software Web Services

Web Services generate, create pdf417 none in software projects Microsoft Office Excel Website A Web Servi pdf417 2d barcode for None ce is defined by the W3S as a software system designed to support interoperable machine-to-machine interaction over a network. We have already looked at how we could create a file and store it on a disk so that another application can read it. This is all fine, but what if the other application was in a different network somewhere else in the world without any access to the disk area where the file was stored We could solve this issue by sending the files using FTP.

In some cases though, we might need to ask to get data instead of sending data, or retrieve data at certain intervals. As long as the size of the data being transferred is limited, using Web Services would be a good alternative. You should know the basics of a Web Service before reading this chapter, and some good starting points are: .



After readi Software PDF-417 2d barcode ng this chapter, you will learn how to: Create a Web Service that exposes AX logic Publish a Web Service to IIS Consume a web service from AX. Expose AX logic using web services Before we h PDF 417 for None ave a look at how to expose AX logic by using a Web Service, let"s look at how the AX logic is triggered by the external application.. Web Services What we wou Software PDF 417 ld like is to have an external application (can also be internal) to execute a method in a Web Service and have that Web Service start a method in AX. The result is sent back through the same flow by which the methods were triggered..

IIS External Application Internet Web Service .NetBC Dynamics AX As you can Software PDF417 see in the previous conceptual diagram, the request is sent from an external application through the Internet to a Web Service that runs on a Microsoft Internet Information Services (IIS) Web server. The Web Service uses the .NET Business Connector to create a session in AX and to execute a method in AX.

When the result is returned from AX, it is passed back to the calling application the same way the request arrived.. Creating a Web Service that expose AX logic In our exam pdf417 for None ple we will create a web service in .NET that will use the .NET Business Connector to log on to AX and to execute business logic within AX.

Our Web Service will contain two methods, one that returns the physical on-hand quantity of one specific item. The other method returns on-order quantity (what we expect to receive). 1.

First, we have to open Visual Studio and create a new project as shown below: Select Web under Visual C# in the Project types tree and select ASP.NET Web Service Application under the Visual Studio installed templates. Give the project a descriptive name and click on OK.

. [ 274 ]. 11 . 2. The next thing we need to do is to add a reference to the .NET Business Connector.

This is done the exact same way as we did in the previous chapter under the Add a reference to .NET Business Connector section. 3.

We now have to add the reference to the .NET Business Connector by adding it to the "using" list. 4.

We then add a new private method that will log on to AX and create a new web user session and another private method that we use to log off the web user session from AX. 5. Then we have to create the two methods that we would like to expose in our Web Service.

We create one called AvailableNow and another one called AvailableInclOrdered. They are very similar except that they call two different methods in the AX class InventOnHand..

[ 275 ]. Web Services The previou PDF417 for None s steps are implemented in the following code example:. using using using using using using System; System.Collections.Generic; System.

Linq; System.Web; System.Web.

Services; Microsoft.Dynamics.BusinessConnectorNet;.

namespace A PDF417 for None xItemOnHand { /// <summary> /// This web service will return OnHand information regarding a /// given item /// </summary> // Autogenerated code --> [WebService(Namespace = "")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.

ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script // using ASP.NET AJAX, uncomment the following line.

// [System.Web.Script.

Services.ScriptService] // Autogenerated code <-public class ItemOnHand : System.Web.

Services.WebService { Axapta ax; string output; [WebMethod] public string AvailableNow(string itemId) { AxaptaObject inventOnHand; // Logon to AX this.Logon(); // Create a new AxaptaObject of the InventOnHand class // by executing the static method newItemId inventOnHand = (AxaptaObject)ax.

CallStaticClassMethod("InventOnHand", "newItemId", itemId); // Call the method availPhysical to get the qty // and convert it to a string output = inventOnHand.Call("availPhysical").ToString(); // Release the object to the garbage collection inventOnHand.

Dispose(); [ 276 ]. 11 // Logo ff to release the webuser session in AX this.Logoff(); // Return the output return output; } [WebMethod] public string AvailableInclOrdered(string itemId) { AxaptaObject inventOnHand; this.Logon(); inventOnHand = (AxaptaObject)ax.

CallStaticClassMethod("InventOnHand", "newItemId", itemId); output = inventOnHand.Call("availOrdered").ToString(); inventOnHand.

Dispose(); this.Logoff(); return output; } private void Logon() { try { ax = new Axapta(); ax.Logon("ceu", "", "", ""); } catch(Exception e) { output = e.

Message; } } private void Logoff() { try { ax.Logoff(); } catch (Exception e) { output = e.Message; } } } } [ 277 ].

Copyright © . All rights reserved.