MonoTouch, Sharepoint web services and xs:any

戏子无情 提交于 2019-12-06 08:22:39

问题


Has ANYONE gotten a web service call to work with SharePoint to operate with MonoTouch/MonoDevelop/Mono??

I am able to get the WSDL from the typical endpoint (/_vti_bin/Lists.asmx in this case), and MonoDevelop creates a Reference.cs as expected.

I have modified the Reference.cs to include the "name" parameter, so all XmyAnyElements now look like: [System.Xml.Serialization.XmlAnyElement("Any","")] //name and namespace

While this can compile, runtime complains about the XmlNode. Fair enough, I made it into XmlNode[] so it could be an array, which invoke[] seems to want.

I then build a GetListItemsQuery and pass it along to my GetListItems call via: var result = svc.GetListItems ("Tasks", null, q, null, "100", null, null);

While I can connect and get the web service to respond, all responses are coming back with null in the Any field.


回答1:


What I have found that works is quite frustrating, but successful.

Pull up Visual Studio on a Windows machine, start an old-school .Net 2.0 windows form app, and connect to the same WSDL. This will create a new Reference.cs file. Bring that file into your MonoTouch app.

Modify the constructor to use the OLD MonoTouch constr, as the .Net 2.0 one will not compile.

Imported constructor

/// <remarks/>
    public Lists() {
        *this.Url = global::test.Properties.Settings.Default.test_gxgvwn1_Lists; //BREAKS HERE, BY THAT'S OK!*
        if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
            this.UseDefaultCredentials = true;
            this.useDefaultCredentialsSetExplicitly = false;
        }
        else {
            this.useDefaultCredentialsSetExplicitly = true;
        }
    }

MonoTouch generated (I used this):

    public Lists() {
        this.Url = "http://www.mysite.com/_vti_bin/Lists.asmx";
    }

    public Lists(string url) {
        this.Url = url;
    }

Once that is changed, the app will compile and the result = svc.GetListItems() will actually return data in the XmlNodes!



来源:https://stackoverflow.com/questions/8823874/monotouch-sharepoint-web-services-and-xsany

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!