Mono calls windows webService

Source: Internet
Author: User

1.Implement linux mono DevelopWindowsWebService

 

 

 

 

 

 

 

 

 

 

 

 

 

L linux and windows are in a LAN segment

L publish webService in IIs of windows

 

2.WindowsSettings in

LWebServiceCode

Using System;

Using System. Collections. Generic;

Using System. Linq;

Using System. Web;

Using System. Web. Services;

 

Namespace MonoWebService

{

/// <Summary>

/// Summary of Service1

/// </Summary>

[WebService (Namespace = "http://tempuri.org/")]

[WebServiceBinding (ConformsTo = WsiProfiles. BasicProfile1_1)]

[System. ComponentModel. ToolboxItem (false)]

// To allow ASP. net ajax to call this Web service from a script, cancel the comments to the downstream.

// [System. Web. Script. Services. ScriptService]

Public class Service1: System. Web. Services. WebService

{

 

[WebMethod]

Public string HelloWorld ()

{

String text = string. Format ("Machine Name: {0} Time: {1}", this. Server. MachineName, DateTime. Now. ToString ());

 

Return text;

}

}

}

 

L publish webService

 

L test in IE

 

 

L if the fire prevention function of the local machine is enabled, disable it. If the firewall is enabled, windows will block linux access

 

 

3.LinuxSettings in

LMonoCall code in

 

Using System;

Using System. Collections;

Namespace WebServiceCallApp

{

Class MainClass

{

Public static void Main (string [] args)

{

// Console. WriteLine ("Hello World! ");

ArrayList myList = new ArrayList ();

WinService. Service1 myService = new WinService. Service1 ();

Console. Write (myService. HelloWorld ());

Console. Read ();

}

}

}

 

L confirm that Windows WebService is accessible

L add webService to Mono

Be sure to add http: // 10.168.14.131/Service1.asmx? Wsdl

The Wsdl must be available. Otherwise, the monoDevelop cannot find the webService.

 

 

 

 

 

LRunning Effect

 

 

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.