Consuming Webservice in AX 2012

Slides:



Advertisements
Similar presentations
1 CGICGI Common Gateway Interface Server-side Programming Lecture.
Advertisements

11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
1 Web Services I: Returning Data in XML Format. 2 Service-Oriented Architecture (SOA) Old Model for Applications Executables running on individual computers.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
INTRODUCTION TO WEB SERVICES CS 795. What is a Web Service ? Web service is a means by which computers talk to each other over the web using HTTP and.
1 Web Services Visual C# 2008 Step by Step Chapter 30.
Web Services February 14 th, Outline Overview of web services Create a web service with MS.Net Requirements for project Phase II.
Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
JavaScript & jQuery the missing manual Chapter 11
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
CIS 375—Web App Dev II Microsoft’s.NET. 2 Introduction to.NET Steve Ballmer (January 2000): Steve Ballmer "Delivering an Internet-based platform of Next.
Web Services Week 2 Aims: Getting started with creating simple C# applications within Visual Studio.NET Objectives: –An introduction to the syntax of C#.NET.
CSCI 6962: Server-side Design and Programming Web Services.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
© Chinese University, CSE Dept. Distributed Systems / Simple Example Open Microsoft Visual Studio 2005:
Kuassi Mensah Java Products Group Stephen Jones Oracle University.
XML Web Service. Overview of XML Web Service ASP.NET XML Web services enable you to remotely access the properties and methods of classes across a network.
Introduction to Web Services. Examples Using a Web Service Creating a new Web Service.
1 CS 3870/CS 5870: Note 20 Web Service. 2 What is Web Service? Providing functionality online to other applications, Web and Windows applications. The.
Week Six : Writing Web Services Aims: Creating and Consuming student’s first Web Services Learning Outcomes: Familiarity with VS.NET for creating and consuming.
Module 9: Using XML Web Services in a C# Application.
Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services.
C# 1 Web services CSC 298. C# 2 Web services  A technology to make libraries available across the internet.  In Visual Studio,  can create a web service.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
ODS – Introduction to Web Services and BPEL Vakgroep Informatietechnologie Web Services & BPEL Design of Distributed Software.
Lesson 15 Web Services. What Are Web Services Web services are programmable and reusable, much like component software, except that they are more easily.
.NET Mobile Application Development XML Web Services.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
1 Network Access to Charm Programs: CCS Orion Sky Lawlor 2003/10/20.
Introduction to Web Services Srinath Vasireddy Support Professional Developer Support Microsoft Corporation.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
11 jQuery Web Service Client. 22 Objectives You will be able to Use JSON (JavaScript Object Notation) for communcations between browser and server methods.
Windows App Studio Windows App Studio is the tool that makes it fast and easy to build Windows 10 apps. It’s accessible from any device with a browser.
1 Using MVC 6. MVC vs. ASP Web Forms Both run under ASP.NET Can coexist In Web Forms, browser requests page. xxx.aspx and xxx.aspx.cs on the server Page.
WEB SERVICES Jonas Haustad. HOW DOES A WEB SERVICE WORK Client request WSDL from web service Client create client-side code Client sends XML request to.
6.2 XML Web Services Vinod Unny Enterprise InfoTech Microsoft Regional Director, North India.
Jim Fawcett CSE686 – Internet Programming Spring 2014
Progress Apama Fundamentals
Introducing the Microsoft® .NET Framework
Jim Fawcett CSE775 – Distributed Objects Spring 2003
Scripting - Client-side vs. Server-side Scripting
Top 8 Best Programming Languages To Learn
CS 3870/CS 5870 Web Service.
Creating,Publishing,Testing and Describing a Web Service
Jim Fawcett CSE686 – Internet Programming Spring 2012
Writing simple Java Web Services using Eclipse
Data Virtualization Tutorial… CORS and CIS
AJAX.
How to Create a Simple Web Service and Use it in ASP.Net
PHP / MySQL Introduction
Module 1: Getting Started
INTRODUCTION TO WEB SERVICES CS 795. What is a Web Service ? Web service is a means by which computers talk to each other over the web using HTTP and.
Web Services Introduction
Web Development in Microsoft Visual Studio 2013
Using the Java Library API
WebServices Using JAX-RPC
Install MySQL Community Server and MySQL Workbench
SOAP web services in Microsoft Azure
Jim Fawcett CSE791 – Distributed Objects Spring 2002
A Little Bit of Active Server Pages (ASP)
IS 135 Business Programming
Blazor A new framework for browser-based .NET apps Ryan Nowak
.NET Web Services by Akram Mohammed.
Presentation transcript:

Consuming Webservice in AX 2012

A web service is any piece of software that makes itself available over the internet and uses a standardized XML messaging system. XML is used to encode all communications to a web service. For example, a client invokes a web service by sending an XML message, then waits for a corresponding XML response. As all communication is in XML, web services are not tied to any one operating system or programming language--Java can talk with Perl; Windows applications can talk with Unix applications.

First, let us create a new Project in Visual Studio First, let us create a new Project in Visual Studio. I'm want something easy and swift, so let's choose .Net 3.5 and ASP.Net Web Service Application. I'm naming the Project “CricketPlayerService”

Now just copy the code underneath and paste it in. using System.Web; using System.Web.Services; namespace CricketPlayerService { public class PlayerInfo public string Name; public double Runs; public double Avg; public double SR; } /// <summary> /// Summary description for Service1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [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]

public class Service1 : System.Web.Services.WebService { [WebMethod] public List< PlayerInfo > SearchPlayer(String query) return new List<PlayerInfo> { new PlayerInfo{ Name = "Sachin Tendulkar", Runs = 18426, Avg = 44.83, SR = 86.24 }, Name = "Virender Sehwag", Runs = 8273, Avg = 35.06, SR = 104.34

new PlayerInfo{ Name = "M.S Dhoni", Runs = 9967, Avg = 51.38, SR = 88.41 }, Name = "Virat kohli", Runs = 9588, Avg = 58.11, SR = 92.15 } }; This is just a simple service that takes a string as input for query of players. It returns a list of 4 players. Now we need to change few things as shown below in IIS to run on Application pool that uses .Net 2 instead of .Net 4.

you can head back to Visual Studio and Publish your built solution  you can head back to Visual Studio and Publish your built solution. Right-click the project and choose Publish

You should be able to test the Web Service by opening a browser and navigating to it. Try loading http://localhost/service1.asmx and see what happens

If you click the SearchService-link you will get a description of that service and since it takes a simple string you can invoke the service from here.  just press invoke and watch it open the result.

Create a new Visual Studio Project Select .Net Framework 4 Select a template from Visual C# and Windows Select the Class Library as template. Give it a name like "DynamicsAXCricketService". Add a Service Reference and point to http://localhost/service1.asmx Add the project to the AOT Deploy as shown below

In order to get you started quickly, Note you need to make sure you have selected allow hot swapping of assembly in Server Configuration before you deploy

copy and paste the below job in Ax 2012 jobs and run see how you results are.  public static void CricketService(Args args) { DynamicsAXCricketService.ServiceReference1.Service1SoapClient wcfClient; DynamicsAXCricketService.ServiceReference1.PlayerInfo[] playerInfoArray; DynamicsAXCricketService.ServiceReference1.PlayerInfo playerInfo; System.ServiceModel.Description.ServiceEndpoint endPoint; System.ServiceModel.EndpointAddress endPointAddress; System.Exception ex; System.Type type; int i, numOfPlayer; str name; real Runs,Average,StrikeRate; try type = CLRInterop::getType('DynamicsAXCricketService.ServiceReference1.Service1SoapClient'); wcfClient = AifUtil::createServiceClient(type);

endPointAddress = new System. ServiceModel endPointAddress = new System.ServiceModel.EndpointAddress("http://localhost/service1.asmx"); endPoint = wcfClient.get_Endpoint(); endPoint.set_Address(endPointAddress); playerInfoArray = wcfClient.SearchPlayer("All"); numOfPlayer = playerInfoArray.get_Count(); for(i = 0; i < numOfPlayer; i++) { playerInfo = playerInfoArray.get_Item(i); name = playerInfo.get_Name(); Runs = playerInfo.get_Runs(); Average = playerInfo.get_Avg(); StrikeRate = playerInfo.get_SR(); info(strFmt("Name:%1 -Runs:%2 -Average:%3 -Strike Rate:%4", name, Runs, Average, StrikeRate)); }

catch(Exception::CLRError) { ex = CLRInterop::getLastException(); while(ex) info(CLRInterop::getAnyTypeForObject(ex.ToString())); ex = ex.get_InnerException(); } The Output when running this job is shown below.