Hello everyone.
I've read MSDN manual about creating proxy class to work with Web-
Services.... Created it and cann't make it work properly.
Here is the link to wsdl file: http://api.a1agregator.ru/api.wsdl
The problem is in complex types of return values(with INT or BOOL
proxy class works fine).
"getCountries" method should return 'object[]' value in responce, but
insted I'm getting error message thet there is an error in XML file,
in position where this method is described.

This is the part of *.wsdl file that describes needet to me method:
---------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:typens="urn:api-a1agregator" xmlns:soapenc="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/
XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"; name="api-
a1agregator" targetNamespace="urn:api-a1agregator" xmlns:wsdl="http://
schemas.xmlsoap.org/wsdl/">
  <wsdl:types />
  ..............................
  <wsdl:message name="getCountries" />
  <wsdl:message name="getCountriesResponse">
    <wsdl:part name="getCountriesReturn" type="xsd:anyType" />
  </wsdl:message>
  ..............................
  <wsdl:portType name="ApiPortType">
  ..............................
    <wsdl:operation name="getCountries">
      <documentation>
                                Получение списка стран
                        </documentation>
      <wsdl:input message="typens:getCountries" />
      <wsdl:output message="typens:getCountriesResponse" />
    </wsdl:operation>
  ..............................
  </wsdl:portType>
  ..............................
  <wsdl:binding name="ApiBinding" type="typens:ApiPortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http";
style="rpc" />
  ..............................
    <wsdl:operation name="getCountries">
      <soap:operation soapAction="urn:ApiAction" />
      <wsdl:input>
        <soap:body use="encoded" namespace="urn:api-a1agregator"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="urn:api-a1agregator"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />
      </wsdl:output>
    </wsdl:operation>
  ..............................
  </wsdl:binding>

  <wsdl:service name="api-a1agregatorService">
    <wsdl:port name="ApiPort" binding="typens:ApiBinding">
      <soap:address location="http://api.a1agregator.ru/index.php"; />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
---------------------------------------------------------------------------------------------

And this is part of generated proxy class:
---------------------------------------------------------------------------------------------
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl",
"2.0.50727.3038")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name =
"ApiBinding", Namespace = "urn:api-a1agregator")]
    public partial class apia1agregatorService :
System.Web.Services.Protocols.SoapHttpClientProtocol
    {
        private System.Threading.SendOrPostCallback
getCountriesOperationCompleted;

        /// <remarks/>
        public apia1agregatorService()
        {
            this.Url = "http://api.a1agregator.ru/index.php";;
        }

        /// <remarks/>
        public event getCountriesCompletedEventHandler
getCountriesCompleted;




        /// <remarks/>
        [System.Web.Services.Protocols.SoapRpcMethodAttribute
("urn:ApiAction", RequestNamespace = "urn:api-a1agregator",
ResponseNamespace = "urn:api-a1agregator")]
        [return: System.Xml.Serialization.SoapElementAttribute
("getCountriesReturn")]
        public object getCountries()
        {
            object[] results = this.Invoke("getCountries", new object
[0]);
            return ((object)(results[0]));
        }

        /// <remarks/>
        public void getCountriesAsync()
        {
            this.getCountriesAsync(null);
        }

        /// <remarks/>
        public void getCountriesAsync(object userState)
        {
            if ((this.getCountriesOperationCompleted == null))
            {
                this.getCountriesOperationCompleted = new
System.Threading.SendOrPostCallback
(this.OngetCountriesOperationCompleted);
            }
            this.InvokeAsync("getCountries", new object[0],
this.getCountriesOperationCompleted, userState);
        }

        private void OngetCountriesOperationCompleted(object arg)
        {
            if ((this.getCountriesCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs
invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)
(arg));
                this.getCountriesCompleted(this, new
getCountriesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl",
"2.0.50727.3038")]
        public delegate void getCountriesCompletedEventHandler(object
sender, getCountriesCompletedEventArgs e);

        /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl",
"2.0.50727.3038")]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        public partial class getCountriesCompletedEventArgs :
System.ComponentModel.AsyncCompletedEventArgs
        {

                private object[] results;

            internal getCountriesCompletedEventArgs(object[] results,
System.Exception exception, bool cancelled, object userState) :
                base(exception, cancelled, userState)
            {
                this.results = results;
            }

            /// <remarks/>
            public object Result
            {
                get
                {
                    this.RaiseExceptionIfNecessary();
                    return ((object)(this.results[0]));
                }
            }
        }
    }
---------------------------------------------------------------------------------------------


Please, help me somebody )

Reply via email to