Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Calling web-service from Axapta

Reply
Thread Tools

Calling web-service from Axapta

 
 
dzeaman
Guest
Posts: n/a
 
      12-14-2005
Hi all

I try to call the web-method, which works too long time.
Is there any variants how to stop the web-service by, e.g., clicking "Stop"
button on the custom form?

Also it's interesting to know, if I can organize "callback" (I want Axapta
to display what web-service do in real-time or something like real-time).

Thank you for your comments.
 
Reply With Quote
 
 
 
 
dzeaman
Guest
Posts: n/a
 
      12-24-2005
I didn't wait till replies but maybe my experience will be helpful for someone.

I organize both "Stop"-button and CallBack.
First I found the article of Matt Powell "Server-side asyncronous
web-methods". He advice to use BeginInvoke and EndInvoke for
delegate-methods. But I didn't found how to stop delegate in runtime.

So I try to use method that is not described in MSDN for web-services. Of
course, I didn't invent something new. I just use threading.

First of all I created the private-class TestThread with methods start(),
init() and getResult(). Disadvantage of this method is that you can't send
parameters directly into method, so you need to create init() method for that.

Than I created the thread and web-methods start(), result(), isAlive() and
abort(). Here're they:

private static TestThread testThread;
public static Thread thread;

[WebMethod]
public bool start( string _param )
{
testThread = new TestThread();
testThread.init( _param );
thread = new Thread( new ThreadStart( testThread.start ) );
thread.Start();
return true;
}

[WebMethod]
public bool result()
{
return testThread.getResult();
}

[WebMethod]
public bool isAlive()
{
return thread.IsAlive;
}

[WebMethod]
public bool abort()
{
thread.Abort();
return true;
}

I realize you'll understand this idea.



Callback is also not so hard.

private static ProcessInfo processInfo;

[WebMethod]
public string getProcessInfo()
{
return processInfo.getInfo();
}

And the class:

public class ProcessInfo
{
private static string info;

public string getInfo()
{
string result = info;
info = "";
return result;
}

public string addInfo( string _info )
{
info += _info;
return info;
}
}

That's all.

Best regards,
Andrey Dzizenko.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Axapta consultant =?Utf-8?B?Z3V5c2Jvag==?= Microsoft Certification 1 01-13-2005 09:54 AM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
calling virtual function results in calling function of base class ... tiwy C++ 0 01-09-2005 11:17 PM
Calling FormsAuthentication.SignOut() after calling Response.Flush =?Utf-8?B?TWFydGluIExlZQ==?= ASP .Net 1 09-28-2004 12:47 PM
Server Side button calling page_load before calling it's own click event. Ryan Ternier ASP .Net 4 07-29-2004 01:06 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57