C# 创建soap请求
我尝试使用XmlSerializer和SoapFormatter序列化对象,但无法使输出看起来像这样:C# 创建soap请求,c#,serialization,soap,C#,Serialization,Soap,我尝试使用XmlSerializer和SoapFormatter序列化对象,但无法使输出看起来像这样: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Login xmlns="http://www.myfirm.com/2010/core/ConnectTypes">
<UserLogin>
<UserName>User</UserName>
<Password>PW</Password>
<Mandant>1</Mandant>
</UserLogin>
</Login>
</soap:Body>
</soap:Envelope>
使用者
嗯
1.
我的班级:
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class UserLoginType
{
private string userNameField;
private string passwordField;
private int mandantField;
/// <remarks/>
public string UserName
{
get
{
return this.userNameField;
}
set
{
this.userNameField = value;
}
}
/// <remarks/>
public string Password
{
get
{
return this.passwordField;
}
set
{
this.passwordField = value;
}
}
/// <remarks/>
public int Mandant
{
get
{
return this.mandantField;
}
set
{
this.mandantField = value;
}
}
}
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class LoginType
{
private object itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("LoginToken", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("UserLogin", typeof(UserLoginType))]
public object Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
}
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
公共部分类UserLoginType
{
私有字符串userNameField;
私有字符串密码字段;
曼丹菲尔德私人酒店;
///
公共字符串用户名
{
得到
{
返回this.userNameField;
}
设置
{
this.userNameField=值;
}
}
///
公共字符串密码
{
得到
{
返回此.passwordField;
}
设置
{
this.passwordField=值;
}
}
///
公共国际义务人
{
得到
{
返回此.mandantField;
}
设置
{
this.mandantField=值;
}
}
}
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
公共部分类登录类型
{
私有对象项字段;
///
[System.Xml.Serialization.xmlementAttribute(“LoginToken”,typeof(string))]
[System.Xml.Serialization.XmlElementAttribute(“UserLogin”,typeof(UserLoginType))]
公共对象项
{
得到
{
返回此.itemField;
}
设置
{
this.itemField=值;
}
}
}
有人能帮忙吗?要记录SoapRequest,请尝试MessageInspector或启用Web服务的Web.Config登录。通常,您不必像那样序列化对象。
您应该通过WSDL url添加Web引用,并通过生成的代理类调用服务的方法不幸的是,没有WSDL文件。我需要记录soap请求做什么?!?