.net - Android 版 Mono 中的 Web 引用

标签 .net mono xamarin.android cross-platform

我正在 xamarin-studio 中开发一个 Android 应用程序。在应用程序中,我想向 Web 服务发出 soap 请求,这是我按照描述创建的 here .

问题是,每次请求时我都会收到以下消息的异常:

"Not supported Content-Type in the response: 'text/html; charset=utf-8' Response error message: --" + correct xml-response

我不明白这一点,因为如果我用 soapUI 测试这些方法,我会得到一个有效的 xml。

我也在 Visual Studio 中使用 WCF 尝试过,但它也不起作用。为什么 .net 会将 XML 响应解释为 HTML??

网址是:http://schule.learninglab.tugraz.at/usermanager/soap?wsdl

namespace testApp.schule.learninglab.tugraz.at {
using System;
using System.Web.Services;
using System.Diagnostics;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using System.ComponentModel;


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="MatheTuGrazAtUsermanagerBinding", Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(Student))]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(Schoolclass))]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(Role))]
public partial class MatheTuGrazAtUsermanagerService : System.Web.Services.Protocols.SoapHttpClientProtocol {

    /// <remarks/>
    public MatheTuGrazAtUsermanagerService() {
        this.Url = "http://schule.learninglab.tugraz.at/usermanager/soap";
    }

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

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://schule.learninglab.tugraz.at/usermanager/soap#isUserAllowed", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public LoginCredentials isUserAllowed(string username, string password, int idApp, string hmacClient) {
        object[] results = this.Invoke("isUserAllowed", new object[] {
                    username,
                    password,
                    idApp,
                    hmacClient});
        return ((LoginCredentials)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BeginisUserAllowed(string username, string password, int idApp, string hmacClient, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("isUserAllowed", new object[] {
                    username,
                    password,
                    idApp,
                    hmacClient}, callback, asyncState);
    }

    /// <remarks/>
    public LoginCredentials EndisUserAllowed(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((LoginCredentials)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://schule.learninglab.tugraz.at/usermanager/soap#getRoles", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public Roles getRoles() {
        object[] results = this.Invoke("getRoles", new object[0]);
        return ((Roles)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetRoles(System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("getRoles", new object[0], callback, asyncState);
    }

    /// <remarks/>
    public Roles EndgetRoles(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((Roles)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElement("return")]
    public int getId(string username) {
        object[] results = this.Invoke("getId", new object[] {
                    username});
        return ((int)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetId(string username, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("getId", new object[] {
                    username}, callback, asyncState);
    }

    /// <remarks/>
    public int EndgetId(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((int)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://schule.learninglab.tugraz.at/usermanager/soap#getSchoolclasses", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public Schoolclasses getSchoolclasses(int idUser) {
        object[] results = this.Invoke("getSchoolclasses", new object[] {
                    idUser});
        return ((Schoolclasses)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetSchoolclasses(int idUser, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("getSchoolclasses", new object[] {
                    idUser}, callback, asyncState);
    }

    /// <remarks/>
    public Schoolclasses EndgetSchoolclasses(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((Schoolclasses)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://schule.learninglab.tugraz.at/usermanager/soap#getSchoolclassess", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public Schoolclasses getSchoolclassess(int idUser) {
        object[] results = this.Invoke("getSchoolclassess", new object[] {
                    idUser});
        return ((Schoolclasses)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetSchoolclassess(int idUser, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("getSchoolclassess", new object[] {
                    idUser}, callback, asyncState);
    }

    /// <remarks/>
    public Schoolclasses EndgetSchoolclassess(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((Schoolclasses)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://schule.learninglab.tugraz.at/usermanager/soap#getName", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public Person getName(int idUser) {
        object[] results = this.Invoke("getName", new object[] {
                    idUser});
        return ((Person)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetName(int idUser, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("getName", new object[] {
                    idUser}, callback, asyncState);
    }

    /// <remarks/>
    public Person EndgetName(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((Person)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("http://schule.learninglab.tugraz.at/usermanager/soap#getStudentsToClass", RequestNamespace="http://schule.learninglab.tugraz.at/usermanager/soap", ResponseNamespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public Students getStudentsToClass(int idSchoolclass) {
        object[] results = this.Invoke("getStudentsToClass", new object[] {
                    idSchoolclass});
        return ((Students)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetStudentsToClass(int idSchoolclass, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("getStudentsToClass", new object[] {
                    idSchoolclass}, callback, asyncState);
    }

    /// <remarks/>
    public Students EndgetStudentsToClass(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((Students)(results[0]));
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class LoginCredentials {

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public System.Nullable<bool> accepted;

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public string hmac;

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public System.Nullable<int> idUser;

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public string message;

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public Roles roles;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Roles {

    /// <remarks/>
    public Role[] roles;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Role {

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public string name;

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public System.Nullable<int> rank;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Student {

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public System.Nullable<int> id;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string firstname;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string lastname;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string username;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Students {

    /// <remarks/>
    public Student[] students;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Person {

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string firstname;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string lastname;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string username;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Schoolclass {

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public System.Nullable<int> id;

    /// <remarks/>
    [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
    public string name;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("XamarinStudio", "4.0.0.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schule.learninglab.tugraz.at/usermanager/soap")]
public partial class Schoolclasses {

    /// <remarks/>
    public Schoolclass[] schoolclasses;
}

wsdl 文件:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schule.learninglab.tugraz.at/usermanager/soap" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="MatheTuGrazAtUsermanager" targetNamespace="http://schule.learninglab.tugraz.at/usermanager/soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://schule.learninglab.tugraz.at/usermanager/soap">
      <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
      <xsd:complexType name="Role">
        <xsd:all>
          <xsd:element name="name" nillable="true" type="xsd:string" />
          <xsd:element name="rank" nillable="true" type="xsd:int" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="ArrayOfRole">
        <xsd:complexContent mixed="false">
          <xsd:restriction base="soap-enc:Array">
            <xsd:attribute wsdl:arrayType="tns:Role[]" ref="soap-enc:arrayType" />
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>
      <xsd:complexType name="Roles">
        <xsd:all>
          <xsd:element name="roles" type="tns:ArrayOfRole" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="LoginCredentials">
        <xsd:all>
          <xsd:element name="accepted" nillable="true" type="xsd:boolean" />
          <xsd:element name="hmac" nillable="true" type="xsd:string" />
          <xsd:element name="idUser" nillable="true" type="xsd:int" />
          <xsd:element name="message" nillable="true" type="xsd:string" />
          <xsd:element name="roles" nillable="true" type="tns:Roles" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="Schoolclass">
        <xsd:all>
          <xsd:element name="id" nillable="true" type="xsd:int" />
          <xsd:element name="name" nillable="true" type="xsd:string" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="ArrayOfSchoolclass">
        <xsd:complexContent mixed="false">
          <xsd:restriction base="soap-enc:Array">
            <xsd:attribute wsdl:arrayType="tns:Schoolclass[]" ref="soap-enc:arrayType" />
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>
      <xsd:complexType name="Schoolclasses">
        <xsd:all>
          <xsd:element name="schoolclasses" type="tns:ArrayOfSchoolclass" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="Person">
        <xsd:all>
          <xsd:element name="firstname" nillable="true" type="xsd:string" />
          <xsd:element name="lastname" nillable="true" type="xsd:string" />
          <xsd:element name="username" nillable="true" type="xsd:string" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="Student">
        <xsd:all>
          <xsd:element name="id" nillable="true" type="xsd:int" />
          <xsd:element name="firstname" nillable="true" type="xsd:string" />
          <xsd:element name="lastname" nillable="true" type="xsd:string" />
          <xsd:element name="username" nillable="true" type="xsd:string" />
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="ArrayOfStudent">
        <xsd:complexContent mixed="false">
          <xsd:restriction base="soap-enc:Array">
            <xsd:attribute wsdl:arrayType="tns:Student[]" ref="soap-enc:arrayType" />
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>
      <xsd:complexType name="Students">
        <xsd:all>
          <xsd:element name="students" type="tns:ArrayOfStudent" />
        </xsd:all>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="isUserAllowedIn">
    <wsdl:part name="username" type="xsd:string" />
    <wsdl:part name="password" type="xsd:string" />
    <wsdl:part name="idApp" type="xsd:int" />
    <wsdl:part name="hmacClient" type="xsd:string" />
  </wsdl:message>
  <wsdl:message name="isUserAllowedOut">
    <wsdl:part name="return" type="tns:LoginCredentials" />
  </wsdl:message>
  <wsdl:message name="getRolesIn" />
  <wsdl:message name="getRolesOut">
    <wsdl:part name="return" type="tns:Roles" />
  </wsdl:message>
  <wsdl:message name="getIdIn">
    <wsdl:part name="username" type="xsd:string" />
  </wsdl:message>
  <wsdl:message name="getIdOut">
    <wsdl:part name="return" type="xsd:int" />
  </wsdl:message>
  <wsdl:message name="getSchoolclassesIn">
    <wsdl:part name="idUser" type="xsd:int" />
  </wsdl:message>
  <wsdl:message name="getSchoolclassesOut">
    <wsdl:part name="return" type="tns:Schoolclasses" />
  </wsdl:message>
  <wsdl:message name="getSchoolclassessIn">
    <wsdl:part name="idUser" type="xsd:int" />
  </wsdl:message>
  <wsdl:message name="getSchoolclassessOut">
    <wsdl:part name="return" type="tns:Schoolclasses" />
  </wsdl:message>
  <wsdl:message name="getNameIn">
    <wsdl:part name="idUser" type="xsd:int" />
  </wsdl:message>
  <wsdl:message name="getNameOut">
    <wsdl:part name="return" type="tns:Person" />
  </wsdl:message>
  <wsdl:message name="getStudentsToClassIn">
    <wsdl:part name="idSchoolclass" type="xsd:int" />
  </wsdl:message>
  <wsdl:message name="getStudentsToClassOut">
    <wsdl:part name="return" type="tns:Students" />
  </wsdl:message>
  <wsdl:portType name="MatheTuGrazAtUsermanagerPort">
    <wsdl:operation name="isUserAllowed">
      <documentation>This Method returns the login credentials of the user</documentation>
      <wsdl:input message="tns:isUserAllowedIn" />
      <wsdl:output message="tns:isUserAllowedOut" />
    </wsdl:operation>
    <wsdl:operation name="getRoles">
      <documentation>Returns all available roles as a list with name and rank</documentation>
      <wsdl:input message="tns:getRolesIn" />
      <wsdl:output message="tns:getRolesOut" />
    </wsdl:operation>
    <wsdl:operation name="getId">
      <documentation>Returns the user id to a username</documentation>
      <wsdl:input message="tns:getIdIn" />
      <wsdl:output message="tns:getIdOut" />
    </wsdl:operation>
    <wsdl:operation name="getSchoolclasses">
      <documentation>class will be in the list. If it is a teacher, there will be a list with all classes of the school to which the theare is associated. Returns a SoapFault when there is no class to a user. This happens for extern users</documentation>
      <wsdl:input message="tns:getSchoolclassesIn" />
      <wsdl:output message="tns:getSchoolclassesOut" />
    </wsdl:operation>
    <wsdl:operation name="getSchoolclassess">
      <documentation>class will be in the list. If it is a teacher, there will be a list with all classes of the school to which the theare is associated. Returns a SoapFault when there is no class to a user. This happens for extern users. depreciated!!! Use getSchoolclasses instead!</documentation>
      <wsdl:input message="tns:getSchoolclassessIn" />
      <wsdl:output message="tns:getSchoolclassessOut" />
    </wsdl:operation>
    <wsdl:operation name="getName">
      <documentation>Returns Firstname, Lastname and Username of a user by the user id</documentation>
      <wsdl:input message="tns:getNameIn" />
      <wsdl:output message="tns:getNameOut" />
    </wsdl:operation>
    <wsdl:operation name="getStudentsToClass">
      <documentation>Returns all students of a class as list. Each entry has user id, firstname, lastname and username</documentation>
      <wsdl:input message="tns:getStudentsToClassIn" />
      <wsdl:output message="tns:getStudentsToClassOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="MatheTuGrazAtUsermanagerBinding" type="tns:MatheTuGrazAtUsermanagerPort">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
    <wsdl:operation name="isUserAllowed">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#isUserAllowed" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getRoles">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#getRoles" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getId">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#getId" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getSchoolclasses">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#getSchoolclasses" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getSchoolclassess">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#getSchoolclassess" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getName">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#getName" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getStudentsToClass">
      <soap:operation soapAction="http://schule.learninglab.tugraz.at/usermanager/soap#getStudentsToClass" />
      <wsdl:input>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="http://schule.learninglab.tugraz.at/usermanager/soap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="MatheTuGrazAtUsermanagerService">
    <wsdl:port name="MatheTuGrazAtUsermanagerPort" binding="tns:MatheTuGrazAtUsermanagerBinding">
      <soap:address location="http://schule.learninglab.tugraz.at/usermanager/soap" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

然后我创建一个新的服务实例并尝试调用“getId(string username)”函数。

最佳答案

能否请您发布您的网络服务使用代码。我假设您已经使用 HTTPWebRequest 使用 REST 服务等服务来下载响应。如果是这样的话。试试这个 Project->Add->Webreference。

schule.learninglab.tugraz.at.Roles objSer2=new schule.learninglab.tugraz.at.Roles();            
Console.WriteLine ( objSer2.roles );

关于.net - Android 版 Mono 中的 Web 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30408636/

相关文章:

c# - MonoTouch : Where is Frame. 来源?

c# - Xamarin 形成 android 应用程序没有得到 DeviceToken Parse SDK

visual-studio - 如何验证 Android SDK 模拟器是否在 Hyper-V 中运行

.net - 如何在 Windows 8 中自动运行需要管理员权限的应用程序

c# - 像编辑 ListViewItems 一样编辑 ListView Group Headers

c# - int.Parse() 错误

c# - 在 Mono 中使用预编译的 .NET 程序集 DLL?

mono - 使用 start-stop-daemon 和 mono-service2 是否成功?

.NET 网络服务 - 快速确认,但在后台继续处理

android - 设置 TextView 可绘制对象的颜色