我在OSX 10.9上测试Mono。本指南介绍了如何使用Web服务:http://www.mono-project.com/Web_Services_%28Visual_Basic%29但我无法编译由wdsl编写的代码。
生成VB存根:
gizurmaca00510e:web-service jonas$ wsdl http://dic.googlecode.com/files/GoogleSearch.wsdl-language:vb
Web Services Description Language Utility
Mono Framework v4.0.30319.17020
There were some warnings while generating the code:
http://dic.googlecode.com/files/GoogleSearch.wsdl
- This web reference does not conform to WS-I Basic Profile v1.1
R2706: A wsdl:binding in a DESCRIPTION MUST use the value of "literal"
for the use attribute in all soapbind:body, soapbind:fault,
soapbind:header and soapbind:headerfault elements
* Binding 'GoogleSearchBinding', in Service Description
'urn:GoogleSearch'
R2209: A wsdl:binding in a DESCRIPTION SHOULD bind every wsdl:part of a
wsdl:message in the wsdl:portType to which it refers to one of
soapbind:body, soapbind:header, soapbind:fault or soapbind:headerfault
* Binding 'GoogleSearchBinding', in Service Description
'urn:GoogleSearch'
R2102: A QName reference to a Schema component in a DESCRIPTION MUST
use the namespace defined in the targetNamespace attribute on the
xsd:schema element, or to a namespace defined in the namespace
attribute on an xsd:import element within the xsd:schema element
* XmlSchemaComplexContentRestriction in Schema Schema
'urn:GoogleSearch', in Service Description 'urn:GoogleSearch'
* XmlSchemaAttribute in Schema Schema 'urn:GoogleSearch', in Service
Description 'urn:GoogleSearch'
* XmlSchemaComplexContentRestriction in Schema Schema
'urn:GoogleSearch', in Service Description 'urn:GoogleSearch'
* XmlSchemaAttribute in Schema Schema 'urn:GoogleSearch', in Service
Description 'urn:GoogleSearch'
R2110: In a DESCRIPTION, array declarations MUST NOT extend or restrict
the soapenc:Array type
* XmlSchemaComplexContentRestriction in Schema Schema
'urn:GoogleSearch', in Service Description 'urn:GoogleSearch'
* XmlSchemaComplexContentRestriction in Schema Schema
'urn:GoogleSearch', in Service Description 'urn:GoogleSearch'
R2111: In a DESCRIPTION, array declarations MUST NOT use wsdl:arrayType
attribute in the type declaration
* XmlSchemaAttribute in Schema Schema 'urn:GoogleSearch', in Service
Description 'urn:GoogleSearch'
* XmlSchemaAttribute in Schema Schema 'urn:GoogleSearch', in Service
Description 'urn:GoogleSearch'
Writing file 'GoogleSearchService.vb'
编译代码:
gizurmaca00510e:web-service jonas$ vbnc /target:library GoogleSearchService.vb -r:System.Web.Services.dll,System.Xml.dll
Visual Basic.Net Compiler version 0.0.0.5943 (Mono 3.0 - xamarin/9fc7213)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.
/Users/jonas/git/colmsjo/develvm/excel_sandbox/mono/web-service/GoogleSearchService.vb (66,12) : error VBNC30455: Argument not specified for parameter 'arg' of 'Private Sub OndoGetCachedPageCompleted(arg As Object)'.
/Users/jonas/git/colmsjo/develvm/excel_sandbox/mono/web-service/GoogleSearchService.vb (66,12) : error VBNC30455: Argument not specified for parameter 'arg' of 'Private Sub OndoGetCachedPageCompleted(arg As Object)'.
/Users/jonas/git/colmsjo/develvm/excel_sandbox/mono/web-service/GoogleSearchService.vb (99,12) : error VBNC30455: Argument not specified for parameter 'arg' of 'Private Sub OndoSpellingSuggestionCompleted(arg As Object)'.
/Users/jonas/git/colmsjo/develvm/excel_sandbox/mono/web-service/GoogleSearchService.vb (99,12) : error VBNC30455: Argument not specified for parameter 'arg' of 'Private Sub OndoSpellingSuggestionCompleted(arg As Object)'.
/Users/jonas/git/colmsjo/develvm/excel_sandbox/mono/web-service/GoogleSearchService.vb (132,12) : error VBNC30455: Argument not specified for parameter 'arg' of 'Private Sub OndoGoogleSearchCompleted(arg As Object)'.
/Users/jonas/git/colmsjo/develvm/excel_sandbox/mono/web-service/GoogleSearchService.vb (132,12) : error VBNC30455: Argument not specified for parameter 'arg' of 'Private Sub OndoGoogleSearchCompleted(arg As Object)'.
There were 6 errors and 0 warnings.
Compilation took 00:00:00.8969520
非常感谢任何帮助!
答案 0 :(得分:0)
看起来wsdl没有为代理生成AddressOf
修饰符存在问题。
您可以通过修改此文件来自行解决此问题:
Me.doGetCachedPageOperationCompleted = New System.Threading.SendOrPostCallback(Me.OndoGetCachedPageCompleted)
为:
Me.doGetCachedPageOperationCompleted = New System.Threading.SendOrPostCallback(AddressOf Me.OndoGetCachedPageCompleted)
对于所有三个位置(请注意,行号偏离一个,对于上面的示例,它报告了第66行,但实际行是65)。
或者,您可以使用此已修复的版本:https://gist.github.com/rolfbjarne/cf950b0815f609e679c1