-1

当我在 Visual Studio 2012 中添加服务引用时,它会将这些用于将元素排序到我的所有属性的属性添加到我的 reference.cs。

[System.Xml.Serialization.XmlArrayAttribute(Order=0)]

但是,它会导致肥皂消息无法正确反序列化。当我删除它们时,它可以工作。所以我需要知道如何通过一些配置或任何需要的东西来生成没有属性的reference.cs。我查看了 Reference.svcmap 地图,但没有看到针对此特定问题的设置。
我尝试了 MSDN,但找不到有关此类请求的手动配置的任何内容。

请注意,如果我将其添加为 Web 引用,它将不会添加这些属性,但不想要该路由,因为我想要 aync 处理。

请帮忙!

注意:服务器 Web 服务是第 3 方,是 apache 轴托管服务。

这是wsdl:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:prews="http://www.coda.com/efinance/schemas/presenter/presenter-11.1/webservice" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.coda.com/efinance/schemas/presenter/presenter-11.1/webservice">
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:com="http://www.coda.com/efinance/schemas/common" xmlns:pre="http://www.coda.com/efinance/schemas/presenter" targetNamespace="http://www.coda.com/efinance/schemas/presenter/presenter-11.1/webservice" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:import namespace="http://www.coda.com/efinance/schemas/common" schemaLocation="http://sfdcoda1/coda/wsdl/finance/common/common.xsd"/>
<xsd:import namespace="http://www.coda.com/efinance/schemas/presenter" schemaLocation="http://sfdcoda1/coda/wsdl/finance/presenter/presenter.xsd"/>
<xsd:element name="AddRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" minOccurs="0" type="com:Companies"/>
<xsd:element name="Presenter" type="pre:Presenter">
<xsd:annotation>
<xsd:documentation>
Contains the information for the presenter master you want to create.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ListRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Filter" type="pre:PresenterListFilter">
<xsd:annotation>
<xsd:documentation>
A filter that selects the presenter masters to be listed.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the company in which you attempted to retrieve the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to retrieve.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Presenter" minOccurs="0" type="pre:Presenter">
<xsd:annotation>
<xsd:documentation>
Contains the presenter master you have retrieved from the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OptionsResponse">
<xsd:complexType>
<xsd:attribute name="transactioncoordinator" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="ListResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Filter" type="pre:PresenterListFilter">
<xsd:annotation>
<xsd:documentation>
The filter that was used to select the presenter masters to be listed.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Keys" minOccurs="0" type="com:KeyData">
<xsd:annotation>
<xsd:documentation>
Contains the key information for the listed presenter masters.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DeleteResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the company in which you attempted to delete the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to delete.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UpdateResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MultiCompany" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" type="com:Companies"/>
<xsd:element name="Warning" type="com:Reason"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code for the company in which you attempted to update the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to update.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="TimeStamp" type="com:typeWord">
<xsd:annotation>
<xsd:documentation>
The TimeStamp value for this presenter master in the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MultiCompany" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" type="com:Companies"/>
<xsd:element name="Warning" type="com:Reason"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the company in which you attempted to create the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to create.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="TimeStamp" type="com:typeWord">
<xsd:annotation>
<xsd:documentation>
The TimeStamp value for this presenter master in the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UpdateRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" minOccurs="0" type="com:Companies"/>
<xsd:element name="Presenter" type="pre:Presenter">
<xsd:annotation>
<xsd:documentation>
Contains the information for the presenter master you want to update.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Options">
<xsd:complexType>
<xsd:attribute name="bulkload" type="xsd:boolean"/>
<xsd:attribute name="logtitle" type="com:typeLogTitle"/>
<xsd:attribute name="attachments" type="com:typeAttachments" default="none"/>
<xsd:attribute name="locale" type="com:typeLocale"/>
<xsd:attribute name="origin" type="xsd:string"/>
<xsd:attribute name="user" type="com:typeGeneralCode"/>
<xsd:attribute name="company" type="com:typeGeneralCode"/>
<xsd:attribute name="session" type="xsd:string"/>
<xsd:attribute name="slot" type="xsd:nonNegativeInteger"/>
<xsd:attribute name="transactionid" type="xsd:string"/>
<xsd:attribute name="txtimeout" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DeleteRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Key" type="com:Key">
<xsd:annotation>
<xsd:documentation>
Contains the key identifying the presenter master you want to delete.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Key" type="com:Key">
<xsd:annotation>
<xsd:documentation>
Contains the key identifying the presenter masters you want to retrieve from the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="UpdateResponse">
<part name="UpdateResponse" element="prews:UpdateResponse"/>
</message>
<message name="GetRequest">
<part name="GetRequest" element="prews:GetRequest"/>
</message>
<message name="Options">
<part name="Options" element="prews:Options"/>
</message>
<message name="AddResponse">
<part name="AddResponse" element="prews:AddResponse"/>
</message>
<message name="GetResponse">
<part name="GetResponse" element="prews:GetResponse"/>
</message>
<message name="DeleteResponse">
<part name="DeleteResponse" element="prews:DeleteResponse"/>
</message>
<message name="DeleteRequest">
<part name="DeleteRequest" element="prews:DeleteRequest"/>
</message>
<message name="AddRequest">
<part name="AddRequest" element="prews:AddRequest"/>
</message>
<message name="ListResponse">
<part name="ListResponse" element="prews:ListResponse"/>
</message>
<message name="ListRequest">
<part name="ListRequest" element="prews:ListRequest"/>
</message>
<message name="OptionsResponse">
<part name="OptionsResponse" element="prews:OptionsResponse"/>
</message>
<message name="UpdateRequest">
<part name="UpdateRequest" element="prews:UpdateRequest"/>
</message>
<portType name="PresenterServicePortTypes">
<operation name="Update">
<input message="prews:UpdateRequest"/>
<output message="prews:UpdateResponse"/>
</operation>
<operation name="Add">
<input message="prews:AddRequest"/>
<output message="prews:AddResponse"/>
</operation>
<operation name="Get">
<input message="prews:GetRequest"/>
<output message="prews:GetResponse"/>
</operation>
<operation name="Delete">
<input message="prews:DeleteRequest"/>
<output message="prews:DeleteResponse"/>
</operation>
<operation name="List">
<input message="prews:ListRequest"/>
<output message="prews:ListResponse"/>
</operation>
</portType>
<binding name="PresenterServiceSOAPBinding" type="prews:PresenterServicePortTypes">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Update">
<documentation>
Updates presenter masters in the database using the information you provide.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Update" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="Add">
<documentation>
Creates new presenter masters in the database using the information you provide.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Add" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="Get">
<documentation>
Retrieves the specified presenter masters from the database.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Get" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="Delete">
<documentation>
Deletes the specified presenter master from the database.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Delete" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="List">
<documentation>
Retrieves key information for the specified presenter masters from the database.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/List" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="PresenterService">
<port name="PresenterServicePort" binding="prews:PresenterServiceSOAPBinding">
<soap:address location="http://sfdcoda1/coda/services/finance/presenter/presenter-11.1"/>
</port>
</service>
</definitions>
4

1 回答 1

0

尝试从 DataContract 属性中删除 order 属性。然后,当您使用服务参考时,它也不应该在那里添加 order 属性。

您必须执行以下操作:

[DataContract]
public class DerivedType : BaseType
{
    [DataMember(Order = 0)]
    public string bird;
    [DataMember(Order = 1)]
    public string parrot;
}

只需删除合同中的 Order 属性即可。

于 2013-04-19T17:03:28.787 回答