Нужно посмотреть прокси, сгенерированные студией, а именно какие атрибуты нацелены на возвращаемое функцией значение и на тип этого значения. Сериализатор может возвращать null, если, например, возвращаемое значение находится в другом пространстве имён. Если функция возвращает объекты разных типов, все они должны быть добавлены с помошью XmlInclude.
На мой взгляд все генерится корректно. Но ввиду того, что у меня очень мало опыта с анализом такой информации, допускаю, что я могу ошибаться.
Вот часть прокси класса, который сгенерился. Я на данный момент пытаюсь завести хотя бы login() метод, который возвращает объект класса LoginResponse. Возвращаемый СОАП будет чуть ниже.
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(LogoutResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(StatusResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(LoginResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(OptimizationResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(StressTestResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(NewslettersResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PortfolioEfficiencyResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CheckBankProductsResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchStocksResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(StocksResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(BankPropertiesResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PricesResponse))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PriceResponse))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://valueobjects.APPserver.company.com")]
public abstract partial class Response {
private ErrorCode errorField;
private long updateIdField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public ErrorCode error {
get {
return this.errorField;
}
set {
this.errorField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public long updateId {
get {
return this.updateIdField;
}
set {
this.updateIdField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://valueobjects.APPserver.company.com")]
public partial class AuthenticationTicket
{
private string sessionIdField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)]
public string sessionId
{
get
{
return this.sessionIdField;
}
set
{
this.sessionIdField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://login.valueobjects.APPserver.company.com")]
public partial class User
{
private string firstNameField;
private System.Nullable<System.DateTime> lastLoginField;
private string lastNameField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)]
public string firstName
{
get
{
return this.firstNameField;
}
set
{
this.firstNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)]
public System.Nullable<System.DateTime> lastLogin
{
get
{
return this.lastLoginField;
}
set
{
this.lastLoginField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)]
public string lastName
{
get
{
return this.lastNameField;
}
set
{
this.lastNameField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://login.valueobjects.APPserver.company.com")]
public partial class LoginResponse : Response
{
private AuthenticationTicket ticketField;
private User userField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)]
public AuthenticationTicket ticket
{
get
{
return this.ticketField;
}
set
{
this.ticketField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)]
public User user
{
get
{
return this.userField;
}
set
{
this.userField = value;
}
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="http://services.APPserver.company.com", ResponseNamespace="http://services.APPserver.company.com", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.XmlElementAttribute("loginReturn")]
public LoginResponse login(LoginRequest request) {
object[] results = this.Invoke("login", new object[] {
request});
return ((LoginResponse)(results[0]));
}
/// <remarks/>
public System.IAsyncResult Beginlogin(LoginRequest request, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("login", new object[] {
request}, callback, asyncState);
}
/// <remarks/>
public LoginResponse Endlogin(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((LoginResponse)(results[0]));
}
/// <remarks/>
public void loginAsync(LoginRequest request) {
this.loginAsync(request, null);
}
/// <remarks/>
public void loginAsync(LoginRequest request, object userState) {
if ((this.loginOperationCompleted == null)) {
this.loginOperationCompleted = new System.Threading.SendOrPostCallback(this.OnloginOperationCompleted);
}
this.InvokeAsync("login", new object[] {
request}, this.loginOperationCompleted, userState);
}
private void OnloginOperationCompleted(object arg) {
if ((this.loginCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.loginCompleted(this, new loginCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
Вот возвращаемый SOAP
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<loginResponse xmlns="http://services.APPserver.company.com">
<loginReturn><error xsi:nil="true"/>
<ticket>
<sessionId>96d6a5cb78651316:-26db6402:118f4d20dd5:-7c54</sessionId>
</ticket>
<updateId>766</updateId>
<user>
<firstName>John</firstName>
<lastLogin>2008-04-13T19:50:07.628Z</lastLogin>
<lastName>Smith</lastName>
</user>
</loginReturn>
</loginResponse>
</soapenv:Body>
</soapenv:Envelope>
Последний раз редактировалось 28 April 2008 12:55
|