Spring.net Ajax asynchronous call to WebService Management (I) [original]

Source: Internet
Author: User
Tags class generator

Spring.net has been added to the upgrade of old projects over the past few days, but many problems have been encountered, first of all, the injection of ajaxpro fails, which cannot be injected, spring.net does not provide proxy for ajaxpro like WebService (if anyone has a good solution, please leave a message), so I use WebService instead of ajaxpro for asynchronous calls, how to manage WebService? I saw a lotArticleOnly a few problems can be solved and cannot be understood. Because WebService needs to be asynchronously called, WebService can be injected during the first loading, however, when you call the client, you find that all the injected objects during loading are null. Now let's take a look at my solution:

Code

 

[WebService (namespace = "http://tempuri.org/")]
[Webservicebinding (conformsto = wsiprofiles. basicprofile1_1)]
[System. Web. Script. Services. scriptservice]
Public class WebService: system. Web. Services. WebService
{
Public static userbizimpl getuserbiz ()
{
Spring. Context. iapplicationcontext context = spring. Context. Support. contextregistry. getcontext ();
Return context. GetObject ("userbizimpl") as userbizimpl;
}

Public WebService ()
{
}

[Webmethod]
Public String syshello (string name)
{
Return getuserbiz (). getname (name );
}

}

 

Here, constructor injection is used. If attribute injection is used, the object is null when asynchronous calling is used.

 

 

Conclusion: In spring.netReferencesThe spring.net proxy class overwrites the attributes of WebService and removes. the asmx file is dependent and does not write WebService or other features. However, I am using Asynchronization. If this configuration is used, the injected object will be null. Let's see what the original article says.

--------- Since we have created a server proxy for the Web service, there is no need to apply features such as webmethod in the Web service class. At this time, the. NET basic framework does not see "real" service objects, and. NET is really exposed to the characteristics of applications on the proxy class.

That is to say, we can completely remove the WebService and webmethod features from the service class, leaving only a common. Net object (A Pono ). In the preceding example, the webmethod feature can still work normally after these features are removed, because the proxy class generator can automatically apply the webmethod feature to the interface method to be exported. -----------------

The next article describes how to use spring.net's WebService proxy to manage Web Services, and publish Web services that have been accessed on the client through AOP

From: http://www.cnblogs.com/myssh/archive/2009/07/03/1516436.html

To be continued ................

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.