Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将数据传输对象转换为XmlElement_C#_.net_Asp.net_Wcf_Web Services - Fatal编程技术网

C# 将数据传输对象转换为XmlElement

C# 将数据传输对象转换为XmlElement,c#,.net,asp.net,wcf,web-services,C#,.net,Asp.net,Wcf,Web Services,我有一个像这样的数据对象 namespace WCFDemo { /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.Compo

我有一个像这样的数据对象

namespace WCFDemo
{
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
    [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
    public partial class pricinginput
    {
        /// <remarks/>
        public aRequest request;
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
    public partial class aRequest
    {   
        /// <remarks/>
        [System.Xml.Serialization.XmlAttributeAttribute()]
        public string input1;

        /// <remarks/>
        [System.Xml.Serialization.XmlAttributeAttribute()]
        public string input2;

        /// <remarks/>
        [System.Xml.Serialization.XmlAttributeAttribute()]
        public string input3;
    }
}
我要打电话给服务部

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://Server/Service" xmlns:wcf="http://schemas.datacontract.org/2004/07/WCFDemo">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:pricinginput>
         <!--Optional:-->
         <ser:sourceValue>
            <wcf:request>
               <wcf:input1>?</wcf:input1>
               <wcf:input2>?</wcf:input2>
               <wcf:input3>?</wcf:input3>
            </wcf:request>
         </ser:sourceValue>
      </ser:pricinginput>
   </soapenv:Body>
</soapenv:Envelope>

?
?
?
如何将sourcevalue转换为类似belwo的xmlelemet,my datacontext已经将数据元素定义为input1、Input2的属性

<pricinginput>
    <sourcevalue>
                <request    input1="" input2="" input3=""/>
            <sourcevalue>
</pricinginput>


这样如何:您可以自己开发一个序列化程序,然后将对象序列化为自定义的xml格式?

您的上下文和目标是什么?对SOAP服务使用SOAP消息有什么不对?我需要以给定的格式提取消息并将其发布到不同的服务。
<pricinginput>
    <sourcevalue>
                <request    input1="" input2="" input3=""/>
            <sourcevalue>
</pricinginput>