0

我通过右键单击“服务引用”并输入包含 wsdl 的 URL 在 VS 中创建服务引用。

它有点工作,但属性 AddRobinsonEntryRequest.subscriberEmails 被创建为字符串。它应该是一个 EmailAddress 类型的数组。

我用 XMLSpy 验证了 wsdl,并且据说它是有效的。

如果我在 VS 中打开相同的文件,我会收到错误:类型http://backclick.de/rpc/soap/schemas/types/types:ListOfEmailAddress未定义。

在第 9 行。

这里是wsdl:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch0="http://backclick.de/rpc/soap/schemas/messages" xmlns:sch1="http://backclick.de/rpc/soap/schemas/types" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://backclick.de/rpc/soap/schemas/types" targetNamespace="http://backclick.de/rpc/soap/schemas/types">
    <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://backclick.de/rpc/soap/schemas/messages" xmlns:types="http://backclick.de/rpc/soap/schemas/types" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://backclick.de/rpc/soap/schemas/messages">
            <import namespace="http://backclick.de/rpc/soap/schemas/types"/>
            <element name="AddRobinsonEntryRequest">
                <complexType>
                    <all>
                        <element name="subscriberEmails" type="types:ListOfEmailAddress"/>
                    </all>
                </complexType>
            </element>
            <element name="AddRobinsonEntryResponse">
                <complexType>
                    <sequence>
                        <element name="success" type="boolean"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://backclick.de/rpc/soap/schemas/types">
            <simpleType name="ListOfEmailAddress">
                <list itemType="tns:EmailAddress"/>
            </simpleType>
            <simpleType name="EmailAddress">
                <restriction base="string">
                    <pattern value="[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+(\.[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?"/>
                </restriction>
            </simpleType>
        </schema>
    </wsdl:types>
    <wsdl:message name="AddRobinsonEntryResponse">
        <wsdl:part name="AddRobinsonEntryResponse" element="sch0:AddRobinsonEntryResponse"/>
    </wsdl:message>
    <wsdl:message name="AddRobinsonEntryRequest">
        <wsdl:part name="AddRobinsonEntryRequest" element="sch0:AddRobinsonEntryRequest"/>
    </wsdl:message>
    <wsdl:portType name="BackclickService">
        <wsdl:operation name="AddRobinsonEntry">
            <wsdl:input name="AddRobinsonEntryRequest" message="sch1:AddRobinsonEntryRequest"/>
            <wsdl:output name="AddRobinsonEntryResponse" message="sch1:AddRobinsonEntryResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="BackclickServiceSoap11" type="tns:BackclickService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="AddRobinsonEntry">
            <soap:operation soapAction=""/>
            <wsdl:input name="AddRobinsonEntryRequest">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="AddRobinsonEntryResponse">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="BackclickServiceService">
        <wsdl:port name="BackclickServiceSoap11" binding="tns:BackclickServiceSoap11">
            <soap:address location="http://asp.backclick.de:80/bc/rpc/soap"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

这是生成的代理类:

  public partial class AddRobinsonEntryRequest : object, System.ComponentModel.INotifyPropertyChanged {

        private string subscriberEmailsField;

        /// <remarks/>
        public string subscriberEmails {
            get {
                return this.subscriberEmailsField;
            }
            set {
                this.subscriberEmailsField = value;
                this.RaisePropertyChanged("subscriberEmails");
            }
        }

我必须做什么才能将subscriberEmailsField 生成为数组?

4

1 回答 1

0

I misread the wsdl. subscriberEmails realy expects a string. ListOfEmailAddress is not an array, but a string in the format "mail1@domain.com mail1@domain.com mail2@domain.com"

于 2013-05-28T08:59:11.353 回答