У меня есть SOAP-ответ, который выглядит следующим образом:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<RegisterAccountResponse xmlns="http://site.com/services/player">
<RegisterAccountResult xmlns:a="http://site.com/entities/player/account"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Token i:nil="true" xmlns="http://site.com/contracts/common" xmlns:b="http://site.com/entities/communication"/>
<StatusCode xmlns="http://site.com/contracts/common">UserAlreadyExists</StatusCode>
<StatusMessage xmlns="http://site.com/contracts/common">
Customer with same name and date of birth already registered
</StatusMessage>
<a:PlayerAccount i:nil="true"/>
</RegisterAccountResult>
</RegisterAccountResponse>
</s:Body>
</s:Envelope>
, который каким-то образом заполняет следующий класс ответов:
namespace Site.Messages.Player.Account
{
[DataContract(Namespace = "http://site.com/entities/player/account")]
public class RegistrationResponse : ResponseBase
{
/// <summary>
/// Gets or sets the player account.
/// </summary>
/// <value>The player account.</value>
[DataMember]
public PlayerAccount PlayerAccount { get; set; }
}
}
База ответов:
namespace Site.Messages.Common
{
/// <summary>
/// Base class for all Request / Response classes.
/// </summary>
[DataContract(Namespace = "http://site.com/contracts/common")]
public abstract class ResponseBase : RequestResponseBase
{
}
}
RequestResponseBase:
namespace Site.Messages.Common
{
/// <summary>
/// Base class for all Request / Response classes.
/// </summary>
[DataContract(Namespace = "http://site.com/contracts/common")]
public abstract class RequestResponseBase
{
public string StatusCode; //always null
public string StatusMessage; //always null
public Token Token;
}
}
Кажется, что за запуск этого процесса отвечают следующие строки:
ActivatedClient<Contracts.Player.IAccount> client = null;
try
{
client = new Activator().ConnectPlayerServiceAccount();
return client.Instance.RegisterAccount(request);
}
finally
{
if (client != null) client.Close();
}
На этот раз PlayerAccount
равно нулю, поскольку в сообщении SOAP указано, нообычно там есть сериализованный объект.
У меня есть следующие вопросы:
- Как получить доступ к значению
StatusMessage
, определенному в конверте SOAP?(Я добавил свойство в класс с тем же именем, но оно никогда не заполняется) - Как этот класс даже заполняется?(внутренняя работа, правила и т. д.)
Любые указатели высоко ценятся - но, как вы можете сказать, я новичок в SOAP и просто пытаюсь понять чей-то другой код.