|
28.10.2006, 16:40 | #1 |
Участник
|
Fred Shen: Consuming a Web Service in Dynamics AX 4
Источник: http://fredshen.spaces.live.com/Blog...E4E3!188.entry
============== This will tell you how to use Common Language Runtime Interoperability feature in Dynamics AX 4 to reference a web service. There is a pretty good discussion about this on Microsoft MBS community by Dilip and Mike Frank. To continue, at least you need to have Dot Net Framework SDK 2.0. (Not Visual Studio .Net) We will use the language translation service on www.stanski.com as the referenced web service. Procedure: Download and Install .NET Framework Version 2.0 Software Development Kit. Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt. At the command prompt, run the following command: Wsdl /l:cs /protocol:soap http://www.stanski.com/services/translate/translate.asmx This will generate a C# source code file of proxy classe, which in this situation is TranslationService.cs Then we need to edit TranslationService.cs file to add namespace for it. Use NotePad to edit TranslationService.cs, the edited codes should look like //------------------------------------------------------------------------------ // … namespace DemoAXWebService //Add namespace declaration { using System; … … }//End namespace declaration Compile the cs file to dll file. Type this in the command prompt csc /t:library TranslationService.cs This will generate the TranslationService.dll. Copy the TranslationService.dll to \Program Files\Microsoft Dynamics AX\client\Bin. Start Microsoft Dynamics AX 4.0 Open Application Object Tree, and locate the Reference node. Right click, select Add Reference and register the TranslationService.dll in Dynamics AX. Create a new job named TestWebService static void TestWebService(Args _args) { DemoAXWebService.TranslationService translateService = new DemoAXWebService.TranslationService(); str strLanguage, strMessage; str translateResult; ; strLanguage = 'en_de'; strMessage = 'Test Web Service'; translateResult = translateService.Translate(strLanguage, strMessage); Info(translateResult); } Run the job, you will get the result “Test-Netz-Service”. ============== Источник: http://fredshen.spaces.live.com/Blog...E4E3!188.entry |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|