Spring.net closed business class for webservice attention points and problems

Source: Internet
Author: User

Recently encountered a project that used the title of the method, With spring.net business class closed into WebService for other places call use, feel is quite fresh, so in the garden searched a piece of the garden friend wrote the article (here) oneself also tried to build an environment, finally was smooth run up, but in the middle encountered a few problems, here record.

Concrete construction method no longer repeat, the above article written more clearly, the main problem:

1. How to introduce the configuration file

When referencing Spring.net's configuration file in the config file, I did not create a new configuration file as in the previous article, but instead built an XML file called Settings.xml, but the effect is the same, spring.net can be recognized, because the config file itself is an XML file. The configuration file is then introduced in the context node in the Web.confg file, as described in the previous article <resource uri= "~/settings.xml"/> is no problem, can be successfully started and completed encapsulation, but in another way <resource uri= "Aeesmbly://spring.net/spring.net/settings.xml"/> (in general we use this approach in actual projects, because we are all layering the project, Different layers focus on and handle different businesses, and the above approach applies to referencing the configuration files in the current project set , which is the way to refer to the configuration files in other project sets, and a problem that throws a InputStream null error. The fact is that no configuration file was found because the settings.xml file was not set to "Embedded file" (set in the property).

2. Calling Remote Call problem

After successful launch, click on the method name on the page and then click the Invoke button to see the return result, but in another project with WebClient to make a call with a problem, throw "remote server shut down an existing connection", and then found that only click Invoke button to see the results, Change the browser to copy the address into the return can not be used. The reason is that the remote call protocol is not added to the config file, and the following code is added under the system.web node .

   <webServices>      <protocols>        <add name="httppost"/>        < Add name="httpget"/>      </protocols>    </webServices>

3, return value problem

There is a problem with encapsulating the webservice in this way I have not yet found a workaround, that is, the return value is of type XML and cannot be controlled by the way the type is set in the request header information, such as the JSON format, which is a string string of XML type.

Spring.net closed business class for webservice attention points and problems

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.