简体   繁体   中英

MonoTouch WCF Service Reference.cs Errors

I have a very simple WCF Service it has a single method GetDateTime(), I have it hosted in IIS on Windows 7, all seems to working fine in the windows environment, I can execute using test client application.

On my Mac using MonoTouch I have added a web reference to the Service, it finds the service and generates a whole lot of files.

When I compile the Mono project there is an error in the Reference.cs file that has been generated.

The GetDateTime Method in the interface has been declared with a return type GetDateTimeResponse instead of System.DateTime.

Any idea what has gone wrong is this a bug or have I missed something?

[System.ServiceModel.ServiceContractAttribute(Namespace="LastPrice.win7pro")]
public interface ITest {

    [System.ServiceModel.XmlSerializerFormatAttribute()]
    [System.ServiceModel.OperationContractAttribute(Action="http://win7pro/ITest/GetDateTime", ReplyAction="http://win7pro/ITest/GetDateTimeResponse")]
    GetDateTimeResponse GetDateTime(GetDateTime GetDateTime);

    [System.ServiceModel.XmlSerializerFormatAttribute()]
    [System.ServiceModel.OperationContractAttribute(Action="http://win7pro/ITest/GetDateTime", ReplyAction="http://win7pro/ITest/GetDateTimeResponse", AsyncPattern=true)]
    System.IAsyncResult BeginGetDateTime(GetDateTime GetDateTime, System.AsyncCallback asyncCallback, object userState);

    GetDateTimeResponse EndGetDateTime(System.IAsyncResult result);
}

This is a bug in Mono's WSDL generation.

I created a simple test case for this, using Visual Studio 2012 Web Express, and it is working fine when copying the Reference.cs file from the Windows machine.

This is now fixed in mono/master commit aa2e9ec .

The bug affects all parameterless service methods with complex return types.

As a temporary workaround, use SlSvcUtil.exe on Windows to create the client proxy or add a dummy parameter to your service method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM