How to call the WCF Service using Web Service

Source: Internet
Author: User

WCF is released in basichttpbinding mode ,. net is called according to the Web service method. The automatically generated proxy contains Enumeration type and nullable type parameters. Some differences are found in the proxy, both generate a paired xxspecified field and attribute. You must set this value to true. Otherwise, the corresponding Enumeration type or nullable type will be ignored during WCF serialization. All default values are used, and all values you assign will be ignored, only you can set xxspecified to true.

Code
[Testmethod]
Public   Void Testasmxsendhtmlmail ()
{
Localhost. tencentemail mail =   New Localhost. tencentemail ();
Mail. emailtype = Localhost. tencentmailtype. send_to_meeting;
Mail. emailtypespecified =   True ;
Mail. =   " Toby " ;
Mail. From =   " Geffzhang " ;
Mail. CC =   " Mouse " ;
Mail. bcc =   " Geffzhang " ;
Mail. Title =   " This's a test mail " ;
Mail. Content =   " <H1> This's a test meeting mail. " ;
Mail. bodyformat = Localhost. tencentmailformat. html;
Mail. bodyformatspecified =   True ;
Mail. Priority = Localhost. messagepriority. Hight;
Mail. priorityspecified =   True ;
Mail. organizer =   " Geffzhang " ;
Mail. Location =   " Apsara 1003 " ;
Mail. starttime = Datetime. now;
Mail. starttimespecified =   True ;
Mail. endtime = Datetime. Now. adddays ( 1 );
Mail. endtimespecified =   True ;
Localhost. messageservice =   New Localhost. messageservice ();
Messageservice. application_context =   New Localhost. applicationcontext () {appkey =   " 93ed11c73f7c4ae7a6335ffa9809e4f9 " };
Bool Sendresult;
Bool Sendresultspec;
Messageservice. Sendmail (mail, Out Sendresult, Out Sendresultspec );
Assert. istrue (sendresult );
}

 

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.