Com call of the WCF Interface

Source: Internet
Author: User

Service interfaces are often called across platforms and technologies. When using non-. NET technology (such as ASP and VB6) to call a WCF Service interface, you can only use the com method. There are usually three methods.

1. Use the soap object in the soap SDK

2. Use the httprequest object

3. Use the COM interface of WCF

The third method is relatively simple and recommended for personal use. The third call method is described below.

To meet the COM object call requirements,. Net framework3.5sp1 registers the WCF proxy interface with the COM component object, which is the moniker object. We can use the OLE com Viewer tool to find it.

You can use the GetObject method to obtain this object. ASPCodeDemonstrate how to obtain a moniker object and call it

 1   <  %
2 Response. Write " Coding started! "
3 Response. Write " </BR> "
4
5 Dim Mexico monikerstring
6 Dim Mexservicemoniker
7
8 Mexico monikerstring = " Service: Mexico address = http://xxxxx.aaaa.com: 81/wcfservice1/service1.svc? WSDL "
9 Mexico monikerstring = Mexico monikerstring + " Address = http://xxxx.aaaa.com: 81/wcfservice1/service1.svc/ "
10 Mexico monikerstring = Mexico monikerstring + " , Binding = wshttpbinding_iservice1, bindingnamespace = http://tempuri.org/ "
11 Mexico monikerstring = Mexico monikerstring + " , Contract = iservice1, contractnamespace = http://tempuri.org/ "
12
13 Set Mexservicemoniker = GetObject (Mexmonikerstring)
14
15 Mexico servicemoniker. channelcredentials. setusernamecredential " Wcfcaller " , " Wcfcaller "
16 Response. Write mexservicemoniker. Echo ( " Sss " )
17
18
19 Set Mexservicemoniker = Nothing
20 % >

The parameters used to call the GetObject method include:

1. Metadata Exchange address.

The WSDL file address of the WCF interface.

2. Service address

The service address of the WCF interface, that is, the URI of the SVC file.

3. Binding name

WSDL In the WSDL file: Binding configuration section, name attribute

4. Service Contract name

WSDL In the WSDL file: porttype configuration section, name attribute

If the above configuration is correct and the call is still wrong, it is likely that your service interface contains parameters or return values of the object type, and the data cannot be non.. NET environment. Therefore, if your WCF interface needs to be called across technologies, you must use the interface parameters and return values of the simple data type.

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.