如何解决创建肥皂请求
| 我尝试使用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: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>
我的课程:
[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;
}
}
}
有人可以帮忙吗?
解决方法
若要记录SoapRequest,请尝试使用MessageInspector或为Web Service启用“在Web.Config中登录”。
,通常,您不必像这样序列化我们的对象。
您应该通过WSDL-url添加Web参考,并通过生成的代理类调用服务的方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。