手动配置服务参考

时间:2013-04-19 16:33:19

标签: c# wcf web-services web

当我在visual studio 2012中添加一个服务引用时,它会将这些属性添加到我的reference.cs的所有属性中。

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

但是它会导致soap消息无法正确反序列化。 当我删除它时,它的工作原理。 因此,我需要知道如何通过某些配置或其他任何方式生成没有属性的reference.cs。 我查看了Reference.svcmap地图,但没有看到他们针对这个特定问题的设置 我尝试过MSDN,但在手动配置中找不到任何类型的请求。

请注意,如果我将其添加为Web引用,它将不会添加这些属性,但不希望该路由,因为我希望进行异步处理。

请帮忙!

注意:服务器Web服务是第三方,是一个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>

1 个答案:

答案 0 :(得分:0)

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

你必须做的事情如下:

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

只需删除合约中的订单属性即可。