Hi,

We are running a Web Service using Axis. I am now trying to build a
client using C#.
I generated the proxy classes using wsdl.exe sucessfully and can post
requests  with the C#-proxy classes and receive a response.

-) If the response is a SOAP Fault an exception with the fault is thrown
(expected result)
-) If the response has no error the object (which is type
'ksvLoginResponseType') is NULL (NOT the expected result), when I want
to access a field of the object I receive a
System.NullReferenceException

I suppose the proxy classes are working fine. Can there be an
encoding/namespace issue? (please see wsdl and soap response below)
(When I use an axis client everything works fine!)

Thanx
Hannes Litschauer


SOAP RESPONSE

<?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><response
method="ksvLogin"><payload><info>ok</info></payload></response>
</soapenv:Body>
</soapenv:Envelope>



CODE SNIPPLET:

// after setting all values I invoke ksvLogin
ksvLoginResponseType respObj = service.ksvLogin(kl);

// during the next line, the System.NullReferenceException is thrown
String infoString = respObj.payload.info;



WSDL FILE



<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:s="http://www.w3.org/2001/XMLSchema";
xmlns:s0="https://www.myksv.at/NASApp/axis/services/urn:ksv-premium";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
xmlns="http://schemas.xmlsoap.org/wsdl/";
targetNamespace="https://www.myksv.at/NASApp/axis/services/urn:ksv-premi
um">
        <types>
                <s:schema elementFormDefault="qualified"
targetNamespace="https://www.myksv.at/NASApp/axis/services/urn:ksv-premi
um">
                        <!-- elemente for ms START -->
                        <s:element name="ksvLogin"
type="s0:ksvLoginType"/>
                        <s:element name="responseKsvLogin"
type="s0:ksvLoginResponseType"/>
                        <!--                    <s:element
name="ksvLoginResponse" type="s0:ksvLoginResponse"/>-->
                        <!-- elemente for ms END -->
                        <s:complexType name="ksvLoginType">
                                <s:all>
                                        <s:element name="request">
                                                <s:complexType>
                                                        <s:sequence>
        
<s:element name="payload">
        
<s:complexType>
        
<s:sequence>
        
<s:element name="personId" type="s:string"/>
        
<s:element name="clearingId" type="s:string"/>
        
<s:element name="effectiveId" type="s:string" minOccurs="0"/>
        
<s:element name="password" type="s:string"/>
        
</s:sequence>
        
</s:complexType>
        
</s:element>
                                                        </s:sequence>
                                                        <s:attribute
name="method" type="s:string" use="required" fixed="ksvLogin"/>
                                                        <s:attribute
name="invoke" type="s:string" use="optional" fixed="invoke"/>
                                                </s:complexType>
                                        </s:element>
                                </s:all>
                        </s:complexType>
                        
                                <s:complexType name =
"ksvLoginResponseType">
                                        <s:sequence>
                                                <s:element
name="payload">
                                                        <s:complexType>
                                                                <s:all>
        
<s:element name="info" type="s:string"/>
                                                                </s:all>
                                                        </s:complexType>
                                                </s:element>
                                        </s:sequence>
                                        <s:attribute name="method"
type="s:string" use="required"/>
                                        <s:attribute name="invoke"
type="s:string" use="optional"/>
                                </s:complexType>
                        
                        <s:simpleType name="stcDate">
                                <s:restriction base="s:string">
                                        <s:pattern value="\d{17}"/>
                                </s:restriction>
                        </s:simpleType>
                        <s:simpleType name="person">
                                <s:restriction base="s:string"/>
                        </s:simpleType>
                        <s:simpleType name="clearing">
                                <s:restriction base="s:string"/>
                        </s:simpleType>
                        <s:simpleType name="effective">
                                <s:restriction base="s:string"/>
                        </s:simpleType>
                        <s:simpleType name="response_sent">
                                <s:restriction base="s0:stcDate"/>
                        </s:simpleType>
                        <s:simpleType name="request_received">
                                <s:restriction base="s0:stcDate"/>
                        </s:simpleType>
                        <s:simpleType name="response_id">
                                <s:restriction base="s:string"/>
                        </s:simpleType>
                        <s:simpleType name="request_id">
                                <s:restriction base="s:string"/>
                        </s:simpleType>
                </s:schema>
        </types>
        <message name="ksvLoginRequest">
                <part name="ksvLogin" element="s0:ksvLogin"/>
        </message>
        <message name="ksvLoginResponse">
                <part name="response" element="s0:responseKsvLogin"/>
        </message>
        <portType name="KSVInfoPort">
                <operation name="ksvLogin">
                        <input message="s0:ksvLoginRequest"/>
                        <output message="s0:ksvLoginResponse"/>
                </operation>
        </portType>
        <binding name="KSVInfoBinding" type="s0:KSVInfoPort">
                <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="ksvLogin">
                        <soap:operation
soapAction="urn:ksv-premium#ksvLogin" style="document"/>
                        <input>
                                <soap:body use="literal"
namespace="urn:ksv-premium"/>
                        </input>
                        <output>
                                <soap:body use="literal"
namespace="urn:ksv-premium"/>
                        </output>
                </operation>
        </binding>
        <service name="KSVInfoService">
                <port name="KSVInfoPort" binding="s0:KSVInfoBinding">
                        <soap:address
location="https://www.myksv.at/NASApp/axis/services/urn:ksv-premium"/>
                </port>
        </service>
</definitions>






C SHARP PROXY CLASS:


//----------------------------------------------------------------------
--------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.573
//
//     Changes to this file may cause incorrect behavior and will be
lost if 
//     the code is regenerated.
// </autogenerated>
//----------------------------------------------------------------------
--------

// 
// Der Quellcode wurde von wsdl automatisch generiert.
Version=1.1.4322.573.
// 
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;


/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="KSVInfoBinding",
Namespace="https://www.myksv.at/NASApp/axis/services/urn:ksv-premium";)]
public class KSVInfoService :
System.Web.Services.Protocols.SoapHttpClientProtocol {
    
    /// <remarks/>
    public KSVInfoService() {
        
        this.Url=".........";
    }
    
    /// <remarks/>
 
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:ksv-prem
ium#ksvLogin",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
    [return:
System.Xml.Serialization.XmlElementAttribute("responseKsvLogin",
Namespace="https://www.myksv.at/NASApp/axis/services/urn:ksv-premium";)]
    public ksvLoginResponseType
ksvLogin([System.Xml.Serialization.XmlElementAttribute("ksvLogin",
Namespace="https://www.myksv.at/NASApp/axis/services/urn:ksv-premium";)]
ksvLoginType ksvLogin1) {
        object[] results = this.Invoke("ksvLogin", new object[] {
                    ksvLogin1});
        return ((ksvLoginResponseType)(results[0]));
    }
    
    /// <remarks/>
    public System.IAsyncResult BeginksvLogin(ksvLoginType ksvLogin1,
System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("ksvLogin", new object[] {
                    ksvLogin1}, callback, asyncState);
    }
    
    /// <remarks/>
    public ksvLoginResponseType EndksvLogin(System.IAsyncResult
asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((ksvLoginResponseType)(results[0]));
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="https://www.myksv.
at/NASApp/axis/services/urn:ksv-premium")]
public class ksvLoginType {
    
    /// <remarks/>
    public ksvLoginTypeRequest request;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="https://www.myksv.
at/NASApp/axis/services/urn:ksv-premium")]
public class ksvLoginTypeRequest {
    
    /// <remarks/>
    public ksvLoginTypeRequestPayload payload;
    
    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    [System.ComponentModel.DefaultValueAttribute("ksvLogin")]
    public string method = "ksvLogin";
    
    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    [System.ComponentModel.DefaultValueAttribute("invoke")]
    public string invoke = "invoke";
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="https://www.myksv.
at/NASApp/axis/services/urn:ksv-premium")]
public class ksvLoginTypeRequestPayload {
    
    /// <remarks/>
    public string personId;
    
    /// <remarks/>
    public string clearingId;
    
    /// <remarks/>
    public string effectiveId;
    
    /// <remarks/>
    public string password;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="https://www.myksv.
at/NASApp/axis/services/urn:ksv-premium")]
public class ksvLoginResponseTypePayload {
    
    /// <remarks/>
    public string info;
}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="https://www.myksv.
at/NASApp/axis/services/urn:ksv-premium")]
public class ksvLoginResponseType {
    
    /// <remarks/>
    public ksvLoginResponseTypePayload payload;
    
    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string method;
    
    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string invoke;
}

___________________________________

Mag. Johannes Litschauer
Consultant

Mobil: +43 676 846484-25
E-Mail: [EMAIL PROTECTED]
EBCONT - electronic business consulting team GmbH
Tel: +43 2772 51269-0   |   Fax: +43 2772 51269-9

Reply via email to