.net client + Axis 1.1 server + wrapped param: null result

Discussion in 'ASP .Net Web Services' started by Zihong Lu, Jun 18, 2004.

  1. Zihong Lu

    Zihong Lu Guest

    I have used the following settings in our web services:

    .net framework 1.1 web services client
    Axis 1.1 server (in wsdd file, set style="wrapped")

    Using axis client calls the server, it works fine. However, .net
    client always returns null, even though the soap message has the
    result, for example, for the simple function

    string getSession(string username, string password);

    The SOAP messages in the response seems to be normal, as shown in this
    request/response message:

    ====== Request ======
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <getSession xmlns="urn:myname.com">
    <username xmlns="">admin</username>
    <password xmlns="" />
    </getSession>
    </soap:Body>
    </soap:Envelope>

    ====== Response ======
    287
    <?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:Header>
    <ns1:sessionID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
    soapenv:mustUnderstand="0"
    xmlns:ns1="http://xml.apache.org/axis/session">
    7413200230928429396
    </ns1:sessionID>
    </soapenv:Header>
    <soapenv:Body>
    <getSessionResponse xmlns="urn:myname.com">
    <getSessionReturn>7413200230928429396</getSessionReturn>
    </getSessionResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    0


    No, I don't know why there is a 287 before <?xml> tag and a 0 at the
    end of the response message. This may have something to do with the
    response HTTP header

    Transfer-Encoding: chunked

    in responding to the .net request HTTP header of "Connection:
    Keep-Alive".

    The session ID in SOAP header doesn't seem matter, since I tested the
    call with and without the session ID header. I have serached this
    group for almost a day, the closest I have found is this link:

    http://groups.google.com/groups?selm=

    However, it was talking about serializing complex type there. Can
    someone plese help?


    -Zihong
    Zihong Lu, Jun 18, 2004
    #1
    1. Advertising

  2. you showed the request and response - I guess that would be a request from
    ..NET to AXIS and a response from AXIS to .NET.
    Can I see the WSDL? or failing that, the client-side proxy generated by
    wsdl.exe ??

    I am betting it is an xml namespace issue.

    -D

    "Zihong Lu" <> wrote in message
    news:...
    > I have used the following settings in our web services:
    >
    > .net framework 1.1 web services client
    > Axis 1.1 server (in wsdd file, set style="wrapped")
    >
    > Using axis client calls the server, it works fine. However, .net
    > client always returns null, even though the soap message has the
    > result, for example, for the simple function
    >
    > string getSession(string username, string password);
    >
    > The SOAP messages in the response seems to be normal, as shown in this
    > request/response message:
    >
    > ====== Request ======
    > <?xml version="1.0" encoding="utf-8"?>
    > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > <soap:Body>
    > <getSession xmlns="urn:myname.com">
    > <username xmlns="">admin</username>
    > <password xmlns="" />
    > </getSession>
    > </soap:Body>
    > </soap:Envelope>
    >
    > ====== Response ======
    > 287
    > <?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:Header>
    > <ns1:sessionID

    soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
    > soapenv:mustUnderstand="0"
    > xmlns:ns1="http://xml.apache.org/axis/session">
    > 7413200230928429396
    > </ns1:sessionID>
    > </soapenv:Header>
    > <soapenv:Body>
    > <getSessionResponse xmlns="urn:myname.com">
    > <getSessionReturn>7413200230928429396</getSessionReturn>
    > </getSessionResponse>
    > </soapenv:Body>
    > </soapenv:Envelope>
    > 0
    >
    >
    > No, I don't know why there is a 287 before <?xml> tag and a 0 at the
    > end of the response message. This may have something to do with the
    > response HTTP header
    >
    > Transfer-Encoding: chunked
    >
    > in responding to the .net request HTTP header of "Connection:
    > Keep-Alive".
    >
    > The session ID in SOAP header doesn't seem matter, since I tested the
    > call with and without the session ID header. I have serached this
    > group for almost a day, the closest I have found is this link:
    >
    >

    http://groups.google.com/groups?selm=
    >
    > However, it was talking about serializing complex type there. Can
    > someone plese help?
    >
    >
    > -Zihong
    Dino Chiesa [Microsoft], Jun 18, 2004
    #2
    1. Advertising

  3. Zihong Lu

    Zihong Lu Guest

    Dino,

    Thank you for looking into this. Yes the request/response messages are
    ..net->axis (request) and axis->.net(response).

    Here is the WSDL that I use (Note that I commented out the
    <wsdlsoap:header message="impl:soapHeader" part="sessionID" use="literal"/>
    for getSession(),
    because it is another issue that causing .net confused, it does not know
    what "xsd:long" is.)
    ==================================
    <?xml version="1.0" encoding="UTF-8" ?>
    <wsdl:definitions targetNamespace="urn:myname.com"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    xmlns:impl="urn:myname.com"
    xmlns:intf="urn:myname.com"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:session="http://xml.apache.org/axis/session">

    <documentation />

    <wsdl:types>

    <schema targetNamespace="http://xml.apache.org/axis/session"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <simpleType name="session">
    <restriction base="xsd:long"/>
    </simpleType>
    <element name="sessionID" type="session:session"/>
    </schema>

    <schema targetNamespace="urn:myname.com"
    xmlns="http://www.w3.org/2001/XMLSchema">


    <element name="getSession">
    <complexType>
    <sequence>
    <element name="username" type="xsd:string" />
    <element name="password" type="xsd:string" />
    </sequence>
    </complexType>
    </element>

    <element name="getSessionResponse">
    <complexType>
    <sequence>
    <element name="getSessionReturn" type="xsd:string" />
    </sequence>
    </complexType>
    </element>

    <element name="closeSession">
    <complexType />
    </element>

    <element name="closeSessionResponse">
    <complexType />
    </element>

    </schema>
    </wsdl:types>

    <wsdl:message name="soapHeader">
    <wsdl:part name="sessionID" element="session:sessionID" />
    </wsdl:message>

    <wsdl:message name="getSessionRequest">
    <wsdl:part element="impl:getSession" name="parameters" />
    </wsdl:message>

    <wsdl:message name="getSessionResponse">
    <wsdl:part element="impl:getSessionResponse" name="parameters" />
    </wsdl:message>

    <wsdl:message name="closeSessionRequest">
    <wsdl:part element="impl:closeSession" name="parameters" />
    </wsdl:message>

    <wsdl:message name="closeSessionResponse">
    <wsdl:part element="impl:closeSessionResponse" name="parameters" />
    </wsdl:message>

    <wsdl:portType name="MynameService">

    <wsdl:eek:peration name="getSession" parameterOrder="">
    <wsdl:input message="impl:getSessionRequest"
    name="getSessionRequest" />
    <wsdl:eek:utput message="impl:getSessionResponse"
    name="getSessionResponse" />
    </wsdl:eek:peration>

    <wsdl:eek:peration name="closeSession">
    <wsdl:input message="impl:closeSessionRequest"
    name="closeSessionRequest" />
    <wsdl:eek:utput message="impl:closeSessionResponse"
    name="closeSessionResponse" />
    </wsdl:eek:peration>

    </wsdl:portType>

    <wsdl:binding name="MynameServiceSoapBinding" type="impl:MynameService">
    <wsdlsoap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:eek:peration name="getSession">
    <wsdlsoap:eek:peration soapAction="" />
    <wsdl:input name="getSessionRequest">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:input>
    <wsdl:eek:utput name="getSessionResponse">
    <!-- comment it out. There is another bug in .net for this -->
    <!-- wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/ -->
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:eek:utput>
    </wsdl:eek:peration>

    <wsdl:eek:peration name="closeSession">
    <wsdlsoap:eek:peration soapAction="" />
    <wsdl:input name="closeSessionRequest">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:input>
    <wsdl:eek:utput name="closeSessionResponse">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:eek:utput>
    </wsdl:eek:peration>

    </wsdl:binding>

    <wsdl:service name="MynameServiceService">
    <wsdl:port binding="impl:MynameServiceSoapBinding" name="MynameService">
    <wsdlsoap:address
    location="http://localhost:8080/services/MynameService" />
    </wsdl:port>
    </wsdl:service>

    </wsdl:definitions>

    ============================================

    Generated cs file:
    ============================================
    namespace MyNameSpace{
    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="MynameServiceSoapBindi
    ng", Namespace="urn:myname.com")]
    public class MynameServiceService :
    System.Web.Services.Protocols.SoapHttpClientProtocol {

    public session sessionID;

    /// <remarks/>
    public MynameServiceService() {
    this.Url = "http://localhost:8080/services/MynameService";
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID")]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return:
    System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string
    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    ema.XmlSchemaForm.Unqualified)] string username,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)] string password) {
    object[] results = this.Invoke("getSession", new object[] {
    username,
    password});
    return ((string)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetSession(string username, string
    password, System.AsyncCallback callback, object asyncState) {
    return this.BeginInvoke("getSession", new object[] {
    username,
    password}, callback, asyncState);
    }

    /// <remarks/>
    public string EndgetSession(System.IAsyncResult asyncResult) {
    object[] results = this.EndInvoke(asyncResult);
    return ((string)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public void closeSession() {
    this.Invoke("closeSession", new object[0]);
    }

    /// <remarks/>
    public System.IAsyncResult BegincloseSession(System.AsyncCallback
    callback, object asyncState) {
    return this.BeginInvoke("closeSession", new object[0], callback,
    asyncState);
    }

    /// <remarks/>
    public void EndcloseSession(System.IAsyncResult asyncResult) {
    this.EndInvoke(asyncResult);
    }
    }

    /// <remarks/>

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    axis/session")]
    [System.Xml.Serialization.XmlRootAttribute("sessionID",
    Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    public class session : System.Web.Services.Protocols.SoapHeader {

    /// <remarks/>
    [System.Xml.Serialization.XmlTextAttribute()]
    public string[] Text;
    }
    }

    ==================================================


    "Dino Chiesa [Microsoft]" <> wrote in message
    news:%...
    > you showed the request and response - I guess that would be a request from
    > .NET to AXIS and a response from AXIS to .NET.
    > Can I see the WSDL? or failing that, the client-side proxy generated by
    > wsdl.exe ??
    >
    > I am betting it is an xml namespace issue.
    >
    > -D
    >
    > "Zihong Lu" <> wrote in message
    > news:...
    > > I have used the following settings in our web services:
    > >
    > > .net framework 1.1 web services client
    > > Axis 1.1 server (in wsdd file, set style="wrapped")
    > >
    > > Using axis client calls the server, it works fine. However, .net
    > > client always returns null, even though the soap message has the
    > > result, for example, for the simple function
    > >
    > > string getSession(string username, string password);
    > >
    > > The SOAP messages in the response seems to be normal, as shown in this
    > > request/response message:
    > >
    > > ====== Request ======
    > > <?xml version="1.0" encoding="utf-8"?>
    > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > > <soap:Body>
    > > <getSession xmlns="urn:myname.com">
    > > <username xmlns="">admin</username>
    > > <password xmlns="" />
    > > </getSession>
    > > </soap:Body>
    > > </soap:Envelope>
    > >
    > > ====== Response ======
    > > 287
    > > <?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:Header>
    > > <ns1:sessionID

    > soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
    > > soapenv:mustUnderstand="0"
    > > xmlns:ns1="http://xml.apache.org/axis/session">
    > > 7413200230928429396
    > > </ns1:sessionID>
    > > </soapenv:Header>
    > > <soapenv:Body>
    > > <getSessionResponse xmlns="urn:myname.com">
    > > <getSessionReturn>7413200230928429396</getSessionReturn>
    > > </getSessionResponse>
    > > </soapenv:Body>
    > > </soapenv:Envelope>
    > > 0
    > >
    > >
    > > No, I don't know why there is a 287 before <?xml> tag and a 0 at the
    > > end of the response message. This may have something to do with the
    > > response HTTP header
    > >
    > > Transfer-Encoding: chunked
    > >
    > > in responding to the .net request HTTP header of "Connection:
    > > Keep-Alive".
    > >
    > > The session ID in SOAP header doesn't seem matter, since I tested the
    > > call with and without the session ID header. I have serached this
    > > group for almost a day, the closest I have found is this link:
    > >
    > >

    >

    http://groups.google.com/groups?selm=
    > >
    > > However, it was talking about serializing complex type there. Can
    > > someone plese help?
    > >
    > >
    > > -Zihong

    >
    >
    Zihong Lu, Jun 18, 2004
    #3
  4. Yes, A namespace problem .
    To fix this
    change the attribute on the getSession() method in the generated client side
    proxy to Qualified, from Unqualified

    [return: System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    Form=System.Xml.Schema.XmlSchemaForm.Qualified)]

    Or, you can modify the WSDL to accurately reflect what AXIS is sending back:

    <element name="getSessionReturn" type="xsd:string" form="qualified" />

    and then regenerate the client proxy.

    AXIS is a bit loose with its elementforms (qualified vs unqualified). The
    WSDL doesn't specify it, yet the behavior for the request and response is
    different.
    -D


    "Zihong Lu" <> wrote in message
    news:...
    > Dino,
    >
    > Thank you for looking into this. Yes the request/response messages are
    > .net->axis (request) and axis->.net(response).
    >
    > Here is the WSDL that I use (Note that I commented out the
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"

    use="literal"/>
    > for getSession(),
    > because it is another issue that causing .net confused, it does not know
    > what "xsd:long" is.)
    > ==================================
    > <?xml version="1.0" encoding="UTF-8" ?>
    > <wsdl:definitions targetNamespace="urn:myname.com"
    > xmlns="http://schemas.xmlsoap.org/wsdl/"
    > xmlns:apachesoap="http://xml.apache.org/xml-soap"
    > xmlns:impl="urn:myname.com"
    > xmlns:intf="urn:myname.com"
    > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:session="http://xml.apache.org/axis/session">
    >
    > <documentation />
    >
    > <wsdl:types>
    >
    > <schema targetNamespace="http://xml.apache.org/axis/session"
    > xmlns="http://www.w3.org/2001/XMLSchema">
    > <simpleType name="session">
    > <restriction base="xsd:long"/>
    > </simpleType>
    > <element name="sessionID" type="session:session"/>
    > </schema>
    >
    > <schema targetNamespace="urn:myname.com"
    > xmlns="http://www.w3.org/2001/XMLSchema">
    >
    >
    > <element name="getSession">
    > <complexType>
    > <sequence>
    > <element name="username" type="xsd:string" />
    > <element name="password" type="xsd:string" />
    > </sequence>
    > </complexType>
    > </element>
    >
    > <element name="getSessionResponse">
    > <complexType>
    > <sequence>
    > <element name="getSessionReturn" type="xsd:string" />
    > </sequence>
    > </complexType>
    > </element>
    >
    > <element name="closeSession">
    > <complexType />
    > </element>
    >
    > <element name="closeSessionResponse">
    > <complexType />
    > </element>
    >
    > </schema>
    > </wsdl:types>
    >
    > <wsdl:message name="soapHeader">
    > <wsdl:part name="sessionID" element="session:sessionID" />
    > </wsdl:message>
    >
    > <wsdl:message name="getSessionRequest">
    > <wsdl:part element="impl:getSession" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:message name="getSessionResponse">
    > <wsdl:part element="impl:getSessionResponse" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:message name="closeSessionRequest">
    > <wsdl:part element="impl:closeSession" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:message name="closeSessionResponse">
    > <wsdl:part element="impl:closeSessionResponse" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:portType name="MynameService">
    >
    > <wsdl:eek:peration name="getSession" parameterOrder="">
    > <wsdl:input message="impl:getSessionRequest"
    > name="getSessionRequest" />
    > <wsdl:eek:utput message="impl:getSessionResponse"
    > name="getSessionResponse" />
    > </wsdl:eek:peration>
    >
    > <wsdl:eek:peration name="closeSession">
    > <wsdl:input message="impl:closeSessionRequest"
    > name="closeSessionRequest" />
    > <wsdl:eek:utput message="impl:closeSessionResponse"
    > name="closeSessionResponse" />
    > </wsdl:eek:peration>
    >
    > </wsdl:portType>
    >
    > <wsdl:binding name="MynameServiceSoapBinding" type="impl:MynameService">
    > <wsdlsoap:binding style="document"
    > transport="http://schemas.xmlsoap.org/soap/http" />
    >
    > <wsdl:eek:peration name="getSession">
    > <wsdlsoap:eek:peration soapAction="" />
    > <wsdl:input name="getSessionRequest">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:input>
    > <wsdl:eek:utput name="getSessionResponse">
    > <!-- comment it out. There is another bug in .net for

    this -->
    > <!-- wsdlsoap:header message="impl:soapHeader"

    part="sessionID"
    > use="literal"/ -->
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:eek:utput>
    > </wsdl:eek:peration>
    >
    > <wsdl:eek:peration name="closeSession">
    > <wsdlsoap:eek:peration soapAction="" />
    > <wsdl:input name="closeSessionRequest">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:input>
    > <wsdl:eek:utput name="closeSessionResponse">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:eek:utput>
    > </wsdl:eek:peration>
    >
    > </wsdl:binding>
    >
    > <wsdl:service name="MynameServiceService">
    > <wsdl:port binding="impl:MynameServiceSoapBinding"

    name="MynameService">
    > <wsdlsoap:address
    > location="http://localhost:8080/services/MynameService" />
    > </wsdl:port>
    > </wsdl:service>
    >
    > </wsdl:definitions>
    >
    > ============================================
    >
    > Generated cs file:
    > ============================================
    > namespace MyNameSpace{
    > 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="MynameServiceSoapBindi
    > ng", Namespace="urn:myname.com")]
    > public class MynameServiceService :
    > System.Web.Services.Protocols.SoapHttpClientProtocol {
    >
    > public session sessionID;
    >
    > /// <remarks/>
    > public MynameServiceService() {
    > this.Url = "http://localhost:8080/services/MynameService";
    > }
    >
    > /// <remarks/>
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID")]
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > [return:
    > System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    > Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    > public string
    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > ema.XmlSchemaForm.Unqualified)] string username,
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)] string password) {
    > object[] results = this.Invoke("getSession", new object[] {
    > username,
    > password});
    > return ((string)(results[0]));
    > }
    >
    > /// <remarks/>
    > public System.IAsyncResult BegingetSession(string username, string
    > password, System.AsyncCallback callback, object asyncState) {
    > return this.BeginInvoke("getSession", new object[] {
    > username,
    > password}, callback, asyncState);
    > }
    >
    > /// <remarks/>
    > public string EndgetSession(System.IAsyncResult asyncResult) {
    > object[] results = this.EndInvoke(asyncResult);
    > return ((string)(results[0]));
    > }
    >
    > /// <remarks/>
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > public void closeSession() {
    > this.Invoke("closeSession", new object[0]);
    > }
    >
    > /// <remarks/>
    > public System.IAsyncResult BegincloseSession(System.AsyncCallback
    > callback, object asyncState) {
    > return this.BeginInvoke("closeSession", new object[0],

    callback,
    > asyncState);
    > }
    >
    > /// <remarks/>
    > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > this.EndInvoke(asyncResult);
    > }
    > }
    >
    > /// <remarks/>
    >
    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > axis/session")]
    > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > public class session : System.Web.Services.Protocols.SoapHeader {
    >
    > /// <remarks/>
    > [System.Xml.Serialization.XmlTextAttribute()]
    > public string[] Text;
    > }
    > }
    >
    > ==================================================
    >
    >
    > "Dino Chiesa [Microsoft]" <> wrote in message
    > news:%...
    > > you showed the request and response - I guess that would be a request

    from
    > > .NET to AXIS and a response from AXIS to .NET.
    > > Can I see the WSDL? or failing that, the client-side proxy generated by
    > > wsdl.exe ??
    > >
    > > I am betting it is an xml namespace issue.
    > >
    > > -D
    > >
    > > "Zihong Lu" <> wrote in message
    > > news:...
    > > > I have used the following settings in our web services:
    > > >
    > > > .net framework 1.1 web services client
    > > > Axis 1.1 server (in wsdd file, set style="wrapped")
    > > >
    > > > Using axis client calls the server, it works fine. However, .net
    > > > client always returns null, even though the soap message has the
    > > > result, for example, for the simple function
    > > >
    > > > string getSession(string username, string password);
    > > >
    > > > The SOAP messages in the response seems to be normal, as shown in this
    > > > request/response message:
    > > >
    > > > ====== Request ======
    > > > <?xml version="1.0" encoding="utf-8"?>
    > > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > > > <soap:Body>
    > > > <getSession xmlns="urn:myname.com">
    > > > <username xmlns="">admin</username>
    > > > <password xmlns="" />
    > > > </getSession>
    > > > </soap:Body>
    > > > </soap:Envelope>
    > > >
    > > > ====== Response ======
    > > > 287
    > > > <?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:Header>
    > > > <ns1:sessionID

    > > soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
    > > > soapenv:mustUnderstand="0"
    > > > xmlns:ns1="http://xml.apache.org/axis/session">
    > > > 7413200230928429396
    > > > </ns1:sessionID>
    > > > </soapenv:Header>
    > > > <soapenv:Body>
    > > > <getSessionResponse xmlns="urn:myname.com">
    > > > <getSessionReturn>7413200230928429396</getSessionReturn>
    > > > </getSessionResponse>
    > > > </soapenv:Body>
    > > > </soapenv:Envelope>
    > > > 0
    > > >
    > > >
    > > > No, I don't know why there is a 287 before <?xml> tag and a 0 at the
    > > > end of the response message. This may have something to do with the
    > > > response HTTP header
    > > >
    > > > Transfer-Encoding: chunked
    > > >
    > > > in responding to the .net request HTTP header of "Connection:
    > > > Keep-Alive".
    > > >
    > > > The session ID in SOAP header doesn't seem matter, since I tested the
    > > > call with and without the session ID header. I have serached this
    > > > group for almost a day, the closest I have found is this link:
    > > >
    > > >

    > >

    >

    http://groups.google.com/groups?selm=
    > > >
    > > > However, it was talking about serializing complex type there. Can
    > > > someone plese help?
    > > >
    > > >
    > > > -Zihong

    > >
    > >

    >
    >
    Dino Chiesa [Microsoft], Jun 19, 2004
    #4
  5. Zihong Lu

    Zihong Lu Guest

    Dino,

    Thanks. That works.

    Now I have a second issue: the soap header. As you can see from my eariler
    wsdl file, if I do the following:
    (1) changed the line to <element name="getSessionReturn" type="xsd:string"
    form="qualified"/>, to solve the null result problem;
    (2) uncommented out the line to indicate the soap header in the return
    message:
    <wsdlsoap:header message="impl:soapHeader" part="sessionID" use="literal"
    />

    When invoke the getSession() call, the .net client complained:

    =========================================
    System.InvalidOperationException: The specified type was not recognized:
    name='long',
    namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    xmlns='http://xml.apache.org/axis/session'>.

    at
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    session(Boolean isNullable, Boolean checkType)
    at
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    OutHeaders()

    Do I need to create serializer/deserializer for the SOAP header? I thought
    the created proxy code already recognize it and can serialize it
    automatically, like gSoap does.

    Here is the new generated client proxy:
    ============================
    namespace MyNameSpace{
    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="MynameServiceSoapBindi
    ng", Namespace="urn:myname.com")]
    public class MynameServiceService :
    System.Web.Services.Protocols.SoapHttpClientProtocol {

    public session sessionID;

    /// <remarks/>
    public MynameServiceService() {
    this.Url = "http://localhost:8080/services/MynameService";
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return:
    System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    public string
    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    ema.XmlSchemaForm.Unqualified)] string username,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)] string password) {
    object[] results = this.Invoke("getSession", new object[] {
    username,
    password});
    return ((string)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetSession(string username, string
    password, System.AsyncCallback callback, object asyncState) {
    return this.BeginInvoke("getSession", new object[] {
    username,
    password}, callback, asyncState);
    }

    /// <remarks/>
    public string EndgetSession(System.IAsyncResult asyncResult) {
    object[] results = this.EndInvoke(asyncResult);
    return ((string)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public void closeSession() {
    this.Invoke("closeSession", new object[0]);
    }

    /// <remarks/>
    public System.IAsyncResult BegincloseSession(System.AsyncCallback
    callback, object asyncState) {
    return this.BeginInvoke("closeSession", new object[0], callback,
    asyncState);
    }

    /// <remarks/>
    public void EndcloseSession(System.IAsyncResult asyncResult) {
    this.EndInvoke(asyncResult);
    }
    }

    /// <remarks/>

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    axis/session")]
    [System.Xml.Serialization.XmlRootAttribute("sessionID",
    Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    public class session : System.Web.Services.Protocols.SoapHeader {

    /// <remarks/>
    [System.Xml.Serialization.XmlTextAttribute()]
    public string[] Text;
    }
    }







    "Dino Chiesa [Microsoft]" <> wrote in message
    news:%...
    > Yes, A namespace problem .
    > To fix this
    > change the attribute on the getSession() method in the generated client

    side
    > proxy to Qualified, from Unqualified
    >
    > [return:

    System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    > Form=System.Xml.Schema.XmlSchemaForm.Qualified)]
    >
    > Or, you can modify the WSDL to accurately reflect what AXIS is sending

    back:
    >
    > <element name="getSessionReturn" type="xsd:string" form="qualified" />
    >
    > and then regenerate the client proxy.
    >
    > AXIS is a bit loose with its elementforms (qualified vs unqualified). The
    > WSDL doesn't specify it, yet the behavior for the request and response is
    > different.
    > -D
    >
    >
    > "Zihong Lu" <> wrote in message
    > news:...
    > > Dino,
    > >
    > > Thank you for looking into this. Yes the request/response messages are
    > > .net->axis (request) and axis->.net(response).
    > >
    > > Here is the WSDL that I use (Note that I commented out the
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"

    > use="literal"/>
    > > for getSession(),
    > > because it is another issue that causing .net confused, it does not know
    > > what "xsd:long" is.)
    > > ==================================
    > > <?xml version="1.0" encoding="UTF-8" ?>
    > > <wsdl:definitions targetNamespace="urn:myname.com"
    > > xmlns="http://schemas.xmlsoap.org/wsdl/"
    > > xmlns:apachesoap="http://xml.apache.org/xml-soap"
    > > xmlns:impl="urn:myname.com"
    > > xmlns:intf="urn:myname.com"
    > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > > xmlns:session="http://xml.apache.org/axis/session">
    > >
    > > <documentation />
    > >
    > > <wsdl:types>
    > >
    > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > <simpleType name="session">
    > > <restriction base="xsd:long"/>
    > > </simpleType>
    > > <element name="sessionID" type="session:session"/>
    > > </schema>
    > >
    > > <schema targetNamespace="urn:myname.com"
    > > xmlns="http://www.w3.org/2001/XMLSchema">
    > >
    > >
    > > <element name="getSession">
    > > <complexType>
    > > <sequence>
    > > <element name="username" type="xsd:string" />
    > > <element name="password" type="xsd:string" />
    > > </sequence>
    > > </complexType>
    > > </element>
    > >
    > > <element name="getSessionResponse">
    > > <complexType>
    > > <sequence>
    > > <element name="getSessionReturn" type="xsd:string" />
    > > </sequence>
    > > </complexType>
    > > </element>
    > >
    > > <element name="closeSession">
    > > <complexType />
    > > </element>
    > >
    > > <element name="closeSessionResponse">
    > > <complexType />
    > > </element>
    > >
    > > </schema>
    > > </wsdl:types>
    > >
    > > <wsdl:message name="soapHeader">
    > > <wsdl:part name="sessionID" element="session:sessionID" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="getSessionRequest">
    > > <wsdl:part element="impl:getSession" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="getSessionResponse">
    > > <wsdl:part element="impl:getSessionResponse" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="closeSessionRequest">
    > > <wsdl:part element="impl:closeSession" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="closeSessionResponse">
    > > <wsdl:part element="impl:closeSessionResponse" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:portType name="MynameService">
    > >
    > > <wsdl:eek:peration name="getSession" parameterOrder="">
    > > <wsdl:input message="impl:getSessionRequest"
    > > name="getSessionRequest" />
    > > <wsdl:eek:utput message="impl:getSessionResponse"
    > > name="getSessionResponse" />
    > > </wsdl:eek:peration>
    > >
    > > <wsdl:eek:peration name="closeSession">
    > > <wsdl:input message="impl:closeSessionRequest"
    > > name="closeSessionRequest" />
    > > <wsdl:eek:utput message="impl:closeSessionResponse"
    > > name="closeSessionResponse" />
    > > </wsdl:eek:peration>
    > >
    > > </wsdl:portType>
    > >
    > > <wsdl:binding name="MynameServiceSoapBinding" type="impl:MynameService">
    > > <wsdlsoap:binding style="document"
    > > transport="http://schemas.xmlsoap.org/soap/http" />
    > >
    > > <wsdl:eek:peration name="getSession">
    > > <wsdlsoap:eek:peration soapAction="" />
    > > <wsdl:input name="getSessionRequest">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:input>
    > > <wsdl:eek:utput name="getSessionResponse">
    > > <!-- comment it out. There is another bug in .net for

    > this -->
    > > <!-- wsdlsoap:header message="impl:soapHeader"

    > part="sessionID"
    > > use="literal"/ -->
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:eek:utput>
    > > </wsdl:eek:peration>
    > >
    > > <wsdl:eek:peration name="closeSession">
    > > <wsdlsoap:eek:peration soapAction="" />
    > > <wsdl:input name="closeSessionRequest">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:input>
    > > <wsdl:eek:utput name="closeSessionResponse">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:eek:utput>
    > > </wsdl:eek:peration>
    > >
    > > </wsdl:binding>
    > >
    > > <wsdl:service name="MynameServiceService">
    > > <wsdl:port binding="impl:MynameServiceSoapBinding"

    > name="MynameService">
    > > <wsdlsoap:address
    > > location="http://localhost:8080/services/MynameService" />
    > > </wsdl:port>
    > > </wsdl:service>
    > >
    > > </wsdl:definitions>
    > >
    > > ============================================
    > >
    > > Generated cs file:
    > > ============================================
    > > namespace MyNameSpace{
    > > 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="MynameServiceSoapBindi
    > > ng", Namespace="urn:myname.com")]
    > > public class MynameServiceService :
    > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > >
    > > public session sessionID;
    > >
    > > /// <remarks/>
    > > public MynameServiceService() {
    > > this.Url = "http://localhost:8080/services/MynameService";
    > > }
    > >
    > > /// <remarks/>
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID")]
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > [return:
    > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    > > Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    > > public string
    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > ema.XmlSchemaForm.Unqualified)] string username,
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)] string password) {
    > > object[] results = this.Invoke("getSession", new object[] {
    > > username,
    > > password});
    > > return ((string)(results[0]));
    > > }
    > >
    > > /// <remarks/>
    > > public System.IAsyncResult BegingetSession(string username,

    string
    > > password, System.AsyncCallback callback, object asyncState) {
    > > return this.BeginInvoke("getSession", new object[] {
    > > username,
    > > password}, callback, asyncState);
    > > }
    > >
    > > /// <remarks/>
    > > public string EndgetSession(System.IAsyncResult asyncResult) {
    > > object[] results = this.EndInvoke(asyncResult);
    > > return ((string)(results[0]));
    > > }
    > >
    > > /// <remarks/>
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > public void closeSession() {
    > > this.Invoke("closeSession", new object[0]);
    > > }
    > >
    > > /// <remarks/>
    > > public System.IAsyncResult

    BegincloseSession(System.AsyncCallback
    > > callback, object asyncState) {
    > > return this.BeginInvoke("closeSession", new object[0],

    > callback,
    > > asyncState);
    > > }
    > >
    > > /// <remarks/>
    > > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > > this.EndInvoke(asyncResult);
    > > }
    > > }
    > >
    > > /// <remarks/>
    > >
    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > axis/session")]
    > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > public class session : System.Web.Services.Protocols.SoapHeader {
    > >
    > > /// <remarks/>
    > > [System.Xml.Serialization.XmlTextAttribute()]
    > > public string[] Text;
    > > }
    > > }
    > >
    > > ==================================================
    > >
    > >
    > > "Dino Chiesa [Microsoft]" <> wrote in message
    > > news:%...
    > > > you showed the request and response - I guess that would be a request

    > from
    > > > .NET to AXIS and a response from AXIS to .NET.
    > > > Can I see the WSDL? or failing that, the client-side proxy generated

    by
    > > > wsdl.exe ??
    > > >
    > > > I am betting it is an xml namespace issue.
    > > >
    > > > -D
    > > >
    > > > "Zihong Lu" <> wrote in message
    > > > news:...
    > > > > I have used the following settings in our web services:
    > > > >
    > > > > .net framework 1.1 web services client
    > > > > Axis 1.1 server (in wsdd file, set style="wrapped")
    > > > >
    > > > > Using axis client calls the server, it works fine. However, .net
    > > > > client always returns null, even though the soap message has the
    > > > > result, for example, for the simple function
    > > > >
    > > > > string getSession(string username, string password);
    > > > >
    > > > > The SOAP messages in the response seems to be normal, as shown in

    this
    > > > > request/response message:
    > > > >
    > > > > ====== Request ======
    > > > > <?xml version="1.0" encoding="utf-8"?>
    > > > > <soap:Envelope

    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > > > > <soap:Body>
    > > > > <getSession xmlns="urn:myname.com">
    > > > > <username xmlns="">admin</username>
    > > > > <password xmlns="" />
    > > > > </getSession>
    > > > > </soap:Body>
    > > > > </soap:Envelope>
    > > > >
    > > > > ====== Response ======
    > > > > 287
    > > > > <?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:Header>
    > > > > <ns1:sessionID
    > > > soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
    > > > > soapenv:mustUnderstand="0"
    > > > > xmlns:ns1="http://xml.apache.org/axis/session">
    > > > > 7413200230928429396
    > > > > </ns1:sessionID>
    > > > > </soapenv:Header>
    > > > > <soapenv:Body>
    > > > > <getSessionResponse xmlns="urn:myname.com">
    > > > > <getSessionReturn>7413200230928429396</getSessionReturn>
    > > > > </getSessionResponse>
    > > > > </soapenv:Body>
    > > > > </soapenv:Envelope>
    > > > > 0
    > > > >
    > > > >
    > > > > No, I don't know why there is a 287 before <?xml> tag and a 0 at the
    > > > > end of the response message. This may have something to do with the
    > > > > response HTTP header
    > > > >
    > > > > Transfer-Encoding: chunked
    > > > >
    > > > > in responding to the .net request HTTP header of "Connection:
    > > > > Keep-Alive".
    > > > >
    > > > > The session ID in SOAP header doesn't seem matter, since I tested

    the
    > > > > call with and without the session ID header. I have serached this
    > > > > group for almost a day, the closest I have found is this link:
    > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?selm=
    > > > >
    > > > > However, it was talking about serializing complex type there. Can
    > > > > someone plese help?
    > > > >
    > > > >
    > > > > -Zihong
    > > >
    > > >

    > >
    > >

    >
    >
    Zihong Lu, Jun 20, 2004
    #5
  6. If I modify your WSDL to type the session ID this way:

    <element name="sessionID" type="sess:session"/>

    <complexType name="session">
    <sequence>
    <element minOccurs="1" maxOccurs="1" name="s" type="xsd:long"/>
    </sequence>
    </complexType>


    it works, and generates a header class like so:

    public class session : System.Web.Services.Protocols.SoapHeader {
    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute()]
    public long s;
    }


    I think the problem is, in .NET the soapheader must derive from
    System.Web.Services.Protocols.SoapHeader . In other words it is a
    complexType. In your WSDL you have it as a simpleType. Generating a client
    proxy from that WSDL results in some confusion. Feels like a bug in the
    wsdl.exe compiler.

    The simple fix is to change the definition of the header type in XSD to the
    above. This generates what you would expect, I think.

    But you have to ensure this synchronizes with the AXIS server. If you are
    generating the server from the WSDL then it should be no problem .

    -Dino




    "Zihong Lu" <> wrote in message
    news:%...
    > Dino,
    >
    > Thanks. That works.
    >
    > Now I have a second issue: the soap header. As you can see from my

    eariler
    > wsdl file, if I do the following:
    > (1) changed the line to <element name="getSessionReturn"

    type="xsd:string"
    > form="qualified"/>, to solve the null result problem;
    > (2) uncommented out the line to indicate the soap header in the return
    > message:
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID" use="literal"
    > />
    >
    > When invoke the getSession() call, the .net client complained:
    >
    > =========================================
    > System.InvalidOperationException: The specified type was not recognized:
    > name='long',
    > namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    > xmlns='http://xml.apache.org/axis/session'>.
    >
    > at
    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    > session(Boolean isNullable, Boolean checkType)
    > at
    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    > OutHeaders()
    >
    > Do I need to create serializer/deserializer for the SOAP header? I

    thought
    > the created proxy code already recognize it and can serialize it
    > automatically, like gSoap does.
    >
    > Here is the new generated client proxy:
    > ============================
    > namespace MyNameSpace{
    > 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="MynameServiceSoapBindi
    > ng", Namespace="urn:myname.com")]
    > public class MynameServiceService :
    > System.Web.Services.Protocols.SoapHttpClientProtocol {
    >
    > public session sessionID;
    >
    > /// <remarks/>
    > public MynameServiceService() {
    > this.Url = "http://localhost:8080/services/MynameService";
    > }
    >
    > /// <remarks/>
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > [return:
    > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > public string
    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > ema.XmlSchemaForm.Unqualified)] string username,
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)] string password) {
    > object[] results = this.Invoke("getSession", new object[] {
    > username,
    > password});
    > return ((string)(results[0]));
    > }
    >
    > /// <remarks/>
    > public System.IAsyncResult BegingetSession(string username, string
    > password, System.AsyncCallback callback, object asyncState) {
    > return this.BeginInvoke("getSession", new object[] {
    > username,
    > password}, callback, asyncState);
    > }
    >
    > /// <remarks/>
    > public string EndgetSession(System.IAsyncResult asyncResult) {
    > object[] results = this.EndInvoke(asyncResult);
    > return ((string)(results[0]));
    > }
    >
    > /// <remarks/>
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > public void closeSession() {
    > this.Invoke("closeSession", new object[0]);
    > }
    >
    > /// <remarks/>
    > public System.IAsyncResult BegincloseSession(System.AsyncCallback
    > callback, object asyncState) {
    > return this.BeginInvoke("closeSession", new object[0],

    callback,
    > asyncState);
    > }
    >
    > /// <remarks/>
    > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > this.EndInvoke(asyncResult);
    > }
    > }
    >
    > /// <remarks/>
    >
    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > axis/session")]
    > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > public class session : System.Web.Services.Protocols.SoapHeader {
    >
    > /// <remarks/>
    > [System.Xml.Serialization.XmlTextAttribute()]
    > public string[] Text;
    > }
    > }
    >
    >
    >
    >
    >
    >
    >
    > "Dino Chiesa [Microsoft]" <> wrote in message
    > news:%...
    > > Yes, A namespace problem .
    > > To fix this
    > > change the attribute on the getSession() method in the generated client

    > side
    > > proxy to Qualified, from Unqualified
    > >
    > > [return:

    > System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    > > Form=System.Xml.Schema.XmlSchemaForm.Qualified)]
    > >
    > > Or, you can modify the WSDL to accurately reflect what AXIS is sending

    > back:
    > >
    > > <element name="getSessionReturn" type="xsd:string" form="qualified" />
    > >
    > > and then regenerate the client proxy.
    > >
    > > AXIS is a bit loose with its elementforms (qualified vs unqualified).

    The
    > > WSDL doesn't specify it, yet the behavior for the request and response

    is
    > > different.
    > > -D
    > >
    > >
    > > "Zihong Lu" <> wrote in message
    > > news:...
    > > > Dino,
    > > >
    > > > Thank you for looking into this. Yes the request/response messages

    are
    > > > .net->axis (request) and axis->.net(response).
    > > >
    > > > Here is the WSDL that I use (Note that I commented out the
    > > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"

    > > use="literal"/>
    > > > for getSession(),
    > > > because it is another issue that causing .net confused, it does not

    know
    > > > what "xsd:long" is.)
    > > > ==================================
    > > > <?xml version="1.0" encoding="UTF-8" ?>
    > > > <wsdl:definitions targetNamespace="urn:myname.com"
    > > > xmlns="http://schemas.xmlsoap.org/wsdl/"
    > > > xmlns:apachesoap="http://xml.apache.org/xml-soap"
    > > > xmlns:impl="urn:myname.com"
    > > > xmlns:intf="urn:myname.com"
    > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    > > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    > > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > > > xmlns:session="http://xml.apache.org/axis/session">
    > > >
    > > > <documentation />
    > > >
    > > > <wsdl:types>
    > > >
    > > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > > <simpleType name="session">
    > > > <restriction base="xsd:long"/>
    > > > </simpleType>
    > > > <element name="sessionID" type="session:session"/>
    > > > </schema>
    > > >
    > > > <schema targetNamespace="urn:myname.com"
    > > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > >
    > > >
    > > > <element name="getSession">
    > > > <complexType>
    > > > <sequence>
    > > > <element name="username" type="xsd:string" />
    > > > <element name="password" type="xsd:string" />
    > > > </sequence>
    > > > </complexType>
    > > > </element>
    > > >
    > > > <element name="getSessionResponse">
    > > > <complexType>
    > > > <sequence>
    > > > <element name="getSessionReturn" type="xsd:string" />
    > > > </sequence>
    > > > </complexType>
    > > > </element>
    > > >
    > > > <element name="closeSession">
    > > > <complexType />
    > > > </element>
    > > >
    > > > <element name="closeSessionResponse">
    > > > <complexType />
    > > > </element>
    > > >
    > > > </schema>
    > > > </wsdl:types>
    > > >
    > > > <wsdl:message name="soapHeader">
    > > > <wsdl:part name="sessionID" element="session:sessionID" />
    > > > </wsdl:message>
    > > >
    > > > <wsdl:message name="getSessionRequest">
    > > > <wsdl:part element="impl:getSession" name="parameters" />
    > > > </wsdl:message>
    > > >
    > > > <wsdl:message name="getSessionResponse">
    > > > <wsdl:part element="impl:getSessionResponse" name="parameters" />
    > > > </wsdl:message>
    > > >
    > > > <wsdl:message name="closeSessionRequest">
    > > > <wsdl:part element="impl:closeSession" name="parameters" />
    > > > </wsdl:message>
    > > >
    > > > <wsdl:message name="closeSessionResponse">
    > > > <wsdl:part element="impl:closeSessionResponse" name="parameters"

    />
    > > > </wsdl:message>
    > > >
    > > > <wsdl:portType name="MynameService">
    > > >
    > > > <wsdl:eek:peration name="getSession" parameterOrder="">
    > > > <wsdl:input message="impl:getSessionRequest"
    > > > name="getSessionRequest" />
    > > > <wsdl:eek:utput message="impl:getSessionResponse"
    > > > name="getSessionResponse" />
    > > > </wsdl:eek:peration>
    > > >
    > > > <wsdl:eek:peration name="closeSession">
    > > > <wsdl:input message="impl:closeSessionRequest"
    > > > name="closeSessionRequest" />
    > > > <wsdl:eek:utput message="impl:closeSessionResponse"
    > > > name="closeSessionResponse" />
    > > > </wsdl:eek:peration>
    > > >
    > > > </wsdl:portType>
    > > >
    > > > <wsdl:binding name="MynameServiceSoapBinding"

    type="impl:MynameService">
    > > > <wsdlsoap:binding style="document"
    > > > transport="http://schemas.xmlsoap.org/soap/http" />
    > > >
    > > > <wsdl:eek:peration name="getSession">
    > > > <wsdlsoap:eek:peration soapAction="" />
    > > > <wsdl:input name="getSessionRequest">
    > > > <wsdlsoap:header message="impl:soapHeader"

    part="sessionID"
    > > > use="literal"/>
    > > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > > </wsdl:input>
    > > > <wsdl:eek:utput name="getSessionResponse">
    > > > <!-- comment it out. There is another bug in .net for

    > > this -->
    > > > <!-- wsdlsoap:header message="impl:soapHeader"

    > > part="sessionID"
    > > > use="literal"/ -->
    > > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > > </wsdl:eek:utput>
    > > > </wsdl:eek:peration>
    > > >
    > > > <wsdl:eek:peration name="closeSession">
    > > > <wsdlsoap:eek:peration soapAction="" />
    > > > <wsdl:input name="closeSessionRequest">
    > > > <wsdlsoap:header message="impl:soapHeader"

    part="sessionID"
    > > > use="literal"/>
    > > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > > </wsdl:input>
    > > > <wsdl:eek:utput name="closeSessionResponse">
    > > > <wsdlsoap:header message="impl:soapHeader"

    part="sessionID"
    > > > use="literal"/>
    > > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > > </wsdl:eek:utput>
    > > > </wsdl:eek:peration>
    > > >
    > > > </wsdl:binding>
    > > >
    > > > <wsdl:service name="MynameServiceService">
    > > > <wsdl:port binding="impl:MynameServiceSoapBinding"

    > > name="MynameService">
    > > > <wsdlsoap:address
    > > > location="http://localhost:8080/services/MynameService" />
    > > > </wsdl:port>
    > > > </wsdl:service>
    > > >
    > > > </wsdl:definitions>
    > > >
    > > > ============================================
    > > >
    > > > Generated cs file:
    > > > ============================================
    > > > namespace MyNameSpace{
    > > > 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="MynameServiceSoapBindi
    > > > ng", Namespace="urn:myname.com")]
    > > > public class MynameServiceService :
    > > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > > >
    > > > public session sessionID;
    > > >
    > > > /// <remarks/>
    > > > public MynameServiceService() {
    > > > this.Url = "http://localhost:8080/services/MynameService";
    > > > }
    > > >
    > > > /// <remarks/>
    > > >

    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID")]
    > > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > >

    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > [return:
    > > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn",
    > > > Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    > > > public string
    > > >

    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > > ema.XmlSchemaForm.Unqualified)] string username,
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > maForm.Unqualified)] string password) {
    > > > object[] results = this.Invoke("getSession", new object[]

    {
    > > > username,
    > > > password});
    > > > return ((string)(results[0]));
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public System.IAsyncResult BegingetSession(string username,

    > string
    > > > password, System.AsyncCallback callback, object asyncState) {
    > > > return this.BeginInvoke("getSession", new object[] {
    > > > username,
    > > > password}, callback, asyncState);
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public string EndgetSession(System.IAsyncResult asyncResult) {
    > > > object[] results = this.EndInvoke(asyncResult);
    > > > return ((string)(results[0]));
    > > > }
    > > >
    > > > /// <remarks/>
    > > >

    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > >

    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > public void closeSession() {
    > > > this.Invoke("closeSession", new object[0]);
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public System.IAsyncResult

    > BegincloseSession(System.AsyncCallback
    > > > callback, object asyncState) {
    > > > return this.BeginInvoke("closeSession", new object[0],

    > > callback,
    > > > asyncState);
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > > > this.EndInvoke(asyncResult);
    > > > }
    > > > }
    > > >
    > > > /// <remarks/>
    > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > axis/session")]
    > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > >
    > > > /// <remarks/>
    > > > [System.Xml.Serialization.XmlTextAttribute()]
    > > > public string[] Text;
    > > > }
    > > > }
    > > >
    > > > ==================================================
    > > >
    > > >
    > > > "Dino Chiesa [Microsoft]" <> wrote in

    message
    > > > news:%...
    > > > > you showed the request and response - I guess that would be a

    request
    > > from
    > > > > .NET to AXIS and a response from AXIS to .NET.
    > > > > Can I see the WSDL? or failing that, the client-side proxy

    generated
    > by
    > > > > wsdl.exe ??
    > > > >
    > > > > I am betting it is an xml namespace issue.
    > > > >
    > > > > -D
    > > > >
    > > > > "Zihong Lu" <> wrote in message
    > > > > news:...
    > > > > > I have used the following settings in our web services:
    > > > > >
    > > > > > .net framework 1.1 web services client
    > > > > > Axis 1.1 server (in wsdd file, set style="wrapped")
    > > > > >
    > > > > > Using axis client calls the server, it works fine. However, .net
    > > > > > client always returns null, even though the soap message has the
    > > > > > result, for example, for the simple function
    > > > > >
    > > > > > string getSession(string username, string password);
    > > > > >
    > > > > > The SOAP messages in the response seems to be normal, as shown in

    > this
    > > > > > request/response message:
    > > > > >
    > > > > > ====== Request ======
    > > > > > <?xml version="1.0" encoding="utf-8"?>
    > > > > > <soap:Envelope

    > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > > > > > <soap:Body>
    > > > > > <getSession xmlns="urn:myname.com">
    > > > > > <username xmlns="">admin</username>
    > > > > > <password xmlns="" />
    > > > > > </getSession>
    > > > > > </soap:Body>
    > > > > > </soap:Envelope>
    > > > > >
    > > > > > ====== Response ======
    > > > > > 287
    > > > > > <?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:Header>
    > > > > > <ns1:sessionID
    > > > > soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
    > > > > > soapenv:mustUnderstand="0"
    > > > > > xmlns:ns1="http://xml.apache.org/axis/session">
    > > > > > 7413200230928429396
    > > > > > </ns1:sessionID>
    > > > > > </soapenv:Header>
    > > > > > <soapenv:Body>
    > > > > > <getSessionResponse xmlns="urn:myname.com">
    > > > > > <getSessionReturn>7413200230928429396</getSessionReturn>
    > > > > > </getSessionResponse>
    > > > > > </soapenv:Body>
    > > > > > </soapenv:Envelope>
    > > > > > 0
    > > > > >
    > > > > >
    > > > > > No, I don't know why there is a 287 before <?xml> tag and a 0 at

    the
    > > > > > end of the response message. This may have something to do with

    the
    > > > > > response HTTP header
    > > > > >
    > > > > > Transfer-Encoding: chunked
    > > > > >
    > > > > > in responding to the .net request HTTP header of "Connection:
    > > > > > Keep-Alive".
    > > > > >
    > > > > > The session ID in SOAP header doesn't seem matter, since I tested

    > the
    > > > > > call with and without the session ID header. I have serached this
    > > > > > group for almost a day, the closest I have found is this link:
    > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?selm=
    > > > > >
    > > > > > However, it was talking about serializing complex type there. Can
    > > > > > someone plese help?
    > > > > >
    > > > > >
    > > > > > -Zihong
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Dino Chiesa [Microsoft], Jun 21, 2004
    #6
  7. Zihong Lu

    Zihong Lu Guest

    Dino,

    I have changed the session declaration in WSDL to what you suggested, as
    showing here:

    <schema targetNamespace="http://xml.apache.org/axis/session"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="sessionID" type="sens:session"/>
    <complexType name="session">
    <sequence>
    <element minOccurs="1" maxOccurs="1" name="id" type="xsd:long"/>
    </sequence>
    </complexType>
    </schema>

    where namespace "sens" was defined in the <wsdl:definitions> as
    xmlns:sens="http://xml.apache.org/axis/session".

    Yes, the generated proxy code now has the same session class derived from
    SoapHeader, as earlier. However, compared to the code generated from
    simpleType declaration in WSDL earlier , the class memeber "id" now has a
    data type of long, instead of the earlier string[], and it has a sensible
    name "id" that I set, instead of the earlier generated name of "Text" (these
    are the only changes in the whole generated client proxy file):

    /// <remarks/>
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    axis/session")]
    [System.Xml.Serialization.XmlRootAttribute("sessionID",
    Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    public class session : System.Web.Services.Protocols.SoapHeader {

    /// <remarks/>

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)]
    public long id;
    }

    I have noticed that the "id" is unqulified, while in the example you showed
    the "s" does not have the "Unqualified" attribute.

    However, even with this change, I still got the same error of
    InvalidOperationException. Since the wsdl file is manually edited, I did
    not change Axis server side. For the session handling, I simply use
    SimpleSessionHandler handler, a convenient handler that Axis provided.

    I have also tested the code with the "Form = ... Unqualified" manually
    removed from the generated proxy code, I still got the same error. The eror
    message is copied here again for completeness:
    =======================================
    Unhandled Exception: System.InvalidOperationException: There is an error in
    XML
    document (4, 4). ---> System.InvalidOperationException: The specified type
    was n
    ot recognized: name='long', namespace='http://www.w3.org/2001/XMLSchema', at
    <se
    ssionID xmlns='http://xml.apache.org/axis/session'>.
    at
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    1_session(Boolean isNullable, Boolean checkType)
    at
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    8_OutHeaders()
    =======================================

    The returned SOAP message is
    <?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:Header>
    <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long"
    xmlns:ns1="http://xml.apache.org/axis/session">-5227012230670020468</ns1:ses
    sionID>
    </soapenv:Header>
    ....

    the position (4,4) indicated in the error message is the ns1:sessionID tag.
    Does this message looks right to you, compared to what WSDL declared?
    Somehow I felt the xsi:type="xsd:long" is not right, since dot/lit style
    don't usually have this.

    -Zihong



    "Dino Chiesa [Microsoft]" <> wrote in message
    news:%...
    > If I modify your WSDL to type the session ID this way:
    >
    > <element name="sessionID" type="sess:session"/>
    >
    > <complexType name="session">
    > <sequence>
    > <element minOccurs="1" maxOccurs="1" name="s"

    type="xsd:long"/>
    > </sequence>
    > </complexType>
    >
    >
    > it works, and generates a header class like so:
    >
    > public class session : System.Web.Services.Protocols.SoapHeader {
    > /// <remarks/>
    > [System.Xml.Serialization.XmlElementAttribute()]
    > public long s;
    > }
    >
    >
    > I think the problem is, in .NET the soapheader must derive from
    > System.Web.Services.Protocols.SoapHeader . In other words it is a
    > complexType. In your WSDL you have it as a simpleType. Generating a

    client
    > proxy from that WSDL results in some confusion. Feels like a bug in the
    > wsdl.exe compiler.
    >
    > The simple fix is to change the definition of the header type in XSD to

    the
    > above. This generates what you would expect, I think.
    >
    > But you have to ensure this synchronizes with the AXIS server. If you are
    > generating the server from the WSDL then it should be no problem .
    >
    > -Dino
    >
    >
    >
    >
    > "Zihong Lu" <> wrote in message
    > news:%...
    > > Dino,
    > >
    > > Thanks. That works.
    > >
    > > Now I have a second issue: the soap header. As you can see from my

    > eariler
    > > wsdl file, if I do the following:
    > > (1) changed the line to <element name="getSessionReturn"

    > type="xsd:string"
    > > form="qualified"/>, to solve the null result problem;
    > > (2) uncommented out the line to indicate the soap header in the return
    > > message:
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"

    use="literal"
    > > />
    > >
    > > When invoke the getSession() call, the .net client complained:
    > >
    > > =========================================
    > > System.InvalidOperationException: The specified type was not recognized:
    > > name='long',
    > > namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    > > xmlns='http://xml.apache.org/axis/session'>.
    > >
    > > at
    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    > > session(Boolean isNullable, Boolean checkType)
    > > at
    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    > > OutHeaders()
    > >
    > > Do I need to create serializer/deserializer for the SOAP header? I

    > thought
    > > the created proxy code already recognize it and can serialize it
    > > automatically, like gSoap does.
    > >
    > > Here is the new generated client proxy:
    > > ============================
    > > namespace MyNameSpace{
    > > 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="MynameServiceSoapBindi
    > > ng", Namespace="urn:myname.com")]
    > > public class MynameServiceService :
    > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > >
    > > public session sessionID;
    > >
    > > /// <remarks/>
    > > public MynameServiceService() {
    > > this.Url = "http://localhost:8080/services/MynameService";
    > > }
    > >
    > > /// <remarks/>
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > [return:
    > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > > public string
    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > ema.XmlSchemaForm.Unqualified)] string username,
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)] string password) {
    > > object[] results = this.Invoke("getSession", new object[] {
    > > username,
    > > password});
    > > return ((string)(results[0]));
    > > }
    > >
    > > /// <remarks/>
    > > public System.IAsyncResult BegingetSession(string username,

    string
    > > password, System.AsyncCallback callback, object asyncState) {
    > > return this.BeginInvoke("getSession", new object[] {
    > > username,
    > > password}, callback, asyncState);
    > > }
    > >
    > > /// <remarks/>
    > > public string EndgetSession(System.IAsyncResult asyncResult) {
    > > object[] results = this.EndInvoke(asyncResult);
    > > return ((string)(results[0]));
    > > }
    > >
    > > /// <remarks/>
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > public void closeSession() {
    > > this.Invoke("closeSession", new object[0]);
    > > }
    > >
    > > /// <remarks/>
    > > public System.IAsyncResult

    BegincloseSession(System.AsyncCallback
    > > callback, object asyncState) {
    > > return this.BeginInvoke("closeSession", new object[0],

    > callback,
    > > asyncState);
    > > }
    > >
    > > /// <remarks/>
    > > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > > this.EndInvoke(asyncResult);
    > > }
    > > }
    > >
    > > /// <remarks/>
    > >
    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > axis/session")]
    > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > public class session : System.Web.Services.Protocols.SoapHeader {
    > >
    > > /// <remarks/>
    > > [System.Xml.Serialization.XmlTextAttribute()]
    > > public string[] Text;
    > > }
    > > }
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    Zihong Lu, Jun 21, 2004
    #7
  8. yes, I think you are correct. the xsi:type="xsd:long" seems to be
    incorrect.

    BUT!

    We are changing the WSDL here without modifying the server. The WSDL
    documents how we would like the service to appear, but if we design the WSDL
    independently of the implementation of the service (in AXIS) , then there is
    no way of knowing if the two independent things coincide.


    It appears that AXIS is using doc/literal for the SOAP body and
    soap-section-5 encoded for the SOAP header. Can you check this in the
    server/service implementation?

    --------------------

    It seems like you may be using the AXIS SimpleSessionHandler ? If so,
    there are others who have tried to get this to work and had troubles, for
    example see the axis user mailing list archive, eg
    http://marc.theaimsgroup.com/?l=axis-user&m=107694009529949&w=2

    or
    http://marc.theaimsgroup.com/?l=axis-user&m=104204463001241&w=2

    or to search the archive:
    http://marc.theaimsgroup.com/?l=axis-user&w=2&r=1&s=sessionhandler&q=b


    The problem is that AXIS's WSDL2Java tool does not handle soapheaders as
    defined in WSDL. If you have a WSDL (such as you have constructed here)
    that specifies a soapheader to be used in the input message, the output
    message, or both, then the Java implementation generated from AXIS'
    "wsdl2java --server-side" does not have any support for that header. As a
    developer using AXIS, you need to provide a handler to extract the header,
    or insert the header, as appropriate.

    The "SimpleSessionHandler" code included with AXIS v1.1 shows this. As you
    can see, there is some DOM walking you have to do to extract the header and
    de-marshal it and validate it and so on. I suppose there is similar work
    you have to do to "add" the header to the response.

    But even with all this I am not sure why the header would be section-5
    encoded when the body is not. In the WSDL model, the soap body can in
    fact be a different "use" than the header. In other words the literal or
    section-5 encoded is specified on the body independently from the header.
    Eg,

    <wsdl:eek:utput name="getSessionResponse">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:eek:utput>



    -Dino



    "Zihong Lu" <> wrote in message
    news:...
    > Dino,
    >
    > I have changed the session declaration in WSDL to what you suggested, as
    > showing here:
    >
    > <schema targetNamespace="http://xml.apache.org/axis/session"
    > xmlns="http://www.w3.org/2001/XMLSchema">
    > <element name="sessionID" type="sens:session"/>
    > <complexType name="session">
    > <sequence>
    > <element minOccurs="1" maxOccurs="1" name="id"

    type="xsd:long"/>
    > </sequence>
    > </complexType>
    > </schema>
    >
    > where namespace "sens" was defined in the <wsdl:definitions> as
    > xmlns:sens="http://xml.apache.org/axis/session".
    >
    > Yes, the generated proxy code now has the same session class derived from
    > SoapHeader, as earlier. However, compared to the code generated from
    > simpleType declaration in WSDL earlier , the class memeber "id" now has a
    > data type of long, instead of the earlier string[], and it has a sensible
    > name "id" that I set, instead of the earlier generated name of "Text"

    (these
    > are the only changes in the whole generated client proxy file):
    >
    > /// <remarks/>
    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > axis/session")]
    > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > public class session : System.Web.Services.Protocols.SoapHeader {
    >
    > /// <remarks/>
    >
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)]
    > public long id;
    > }
    >
    > I have noticed that the "id" is unqulified, while in the example you

    showed
    > the "s" does not have the "Unqualified" attribute.
    >
    > However, even with this change, I still got the same error of
    > InvalidOperationException. Since the wsdl file is manually edited, I did
    > not change Axis server side. For the session handling, I simply use
    > SimpleSessionHandler handler, a convenient handler that Axis provided.
    >
    > I have also tested the code with the "Form = ... Unqualified" manually
    > removed from the generated proxy code, I still got the same error. The

    eror
    > message is copied here again for completeness:
    > =======================================
    > Unhandled Exception: System.InvalidOperationException: There is an error

    in
    > XML
    > document (4, 4). ---> System.InvalidOperationException: The specified type
    > was n
    > ot recognized: name='long', namespace='http://www.w3.org/2001/XMLSchema',

    at
    > <se
    > ssionID xmlns='http://xml.apache.org/axis/session'>.
    > at
    > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > 1_session(Boolean isNullable, Boolean checkType)
    > at
    > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > 8_OutHeaders()
    > =======================================
    >
    > The returned SOAP message is
    > <?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:Header>
    > <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long"
    >

    xmlns:ns1="http://xml.apache.org/axis/session">-5227012230670020468</ns1:ses
    > sionID>
    > </soapenv:Header>
    > ...
    >
    > the position (4,4) indicated in the error message is the ns1:sessionID

    tag.
    > Does this message looks right to you, compared to what WSDL declared?
    > Somehow I felt the xsi:type="xsd:long" is not right, since dot/lit style
    > don't usually have this.
    >
    > -Zihong
    >
    >
    >
    > "Dino Chiesa [Microsoft]" <> wrote in message
    > news:%...
    > > If I modify your WSDL to type the session ID this way:
    > >
    > > <element name="sessionID" type="sess:session"/>
    > >
    > > <complexType name="session">
    > > <sequence>
    > > <element minOccurs="1" maxOccurs="1" name="s"

    > type="xsd:long"/>
    > > </sequence>
    > > </complexType>
    > >
    > >
    > > it works, and generates a header class like so:
    > >
    > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > /// <remarks/>
    > > [System.Xml.Serialization.XmlElementAttribute()]
    > > public long s;
    > > }
    > >
    > >
    > > I think the problem is, in .NET the soapheader must derive from
    > > System.Web.Services.Protocols.SoapHeader . In other words it is a
    > > complexType. In your WSDL you have it as a simpleType. Generating a

    > client
    > > proxy from that WSDL results in some confusion. Feels like a bug in the
    > > wsdl.exe compiler.
    > >
    > > The simple fix is to change the definition of the header type in XSD to

    > the
    > > above. This generates what you would expect, I think.
    > >
    > > But you have to ensure this synchronizes with the AXIS server. If you

    are
    > > generating the server from the WSDL then it should be no problem .
    > >
    > > -Dino
    > >
    > >
    > >
    > >
    > > "Zihong Lu" <> wrote in message
    > > news:%...
    > > > Dino,
    > > >
    > > > Thanks. That works.
    > > >
    > > > Now I have a second issue: the soap header. As you can see from my

    > > eariler
    > > > wsdl file, if I do the following:
    > > > (1) changed the line to <element name="getSessionReturn"

    > > type="xsd:string"
    > > > form="qualified"/>, to solve the null result problem;
    > > > (2) uncommented out the line to indicate the soap header in the return
    > > > message:
    > > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"

    > use="literal"
    > > > />
    > > >
    > > > When invoke the getSession() call, the .net client complained:
    > > >
    > > > =========================================
    > > > System.InvalidOperationException: The specified type was not

    recognized:
    > > > name='long',
    > > > namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    > > > xmlns='http://xml.apache.org/axis/session'>.
    > > >
    > > > at
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    > > > session(Boolean isNullable, Boolean checkType)
    > > > at
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    > > > OutHeaders()
    > > >
    > > > Do I need to create serializer/deserializer for the SOAP header? I

    > > thought
    > > > the created proxy code already recognize it and can serialize it
    > > > automatically, like gSoap does.
    > > >
    > > > Here is the new generated client proxy:
    > > > ============================
    > > > namespace MyNameSpace{
    > > > 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="MynameServiceSoapBindi
    > > > ng", Namespace="urn:myname.com")]
    > > > public class MynameServiceService :
    > > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > > >
    > > > public session sessionID;
    > > >
    > > > /// <remarks/>
    > > > public MynameServiceService() {
    > > > this.Url = "http://localhost:8080/services/MynameService";
    > > > }
    > > >
    > > > /// <remarks/>
    > > >

    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > >

    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > [return:
    > > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > > > public string
    > > >

    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > > ema.XmlSchemaForm.Unqualified)] string username,
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > maForm.Unqualified)] string password) {
    > > > object[] results = this.Invoke("getSession", new object[]

    {
    > > > username,
    > > > password});
    > > > return ((string)(results[0]));
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public System.IAsyncResult BegingetSession(string username,

    > string
    > > > password, System.AsyncCallback callback, object asyncState) {
    > > > return this.BeginInvoke("getSession", new object[] {
    > > > username,
    > > > password}, callback, asyncState);
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public string EndgetSession(System.IAsyncResult asyncResult) {
    > > > object[] results = this.EndInvoke(asyncResult);
    > > > return ((string)(results[0]));
    > > > }
    > > >
    > > > /// <remarks/>
    > > >

    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > >

    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > public void closeSession() {
    > > > this.Invoke("closeSession", new object[0]);
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public System.IAsyncResult

    > BegincloseSession(System.AsyncCallback
    > > > callback, object asyncState) {
    > > > return this.BeginInvoke("closeSession", new object[0],

    > > callback,
    > > > asyncState);
    > > > }
    > > >
    > > > /// <remarks/>
    > > > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > > > this.EndInvoke(asyncResult);
    > > > }
    > > > }
    > > >
    > > > /// <remarks/>
    > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > axis/session")]
    > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > >
    > > > /// <remarks/>
    > > > [System.Xml.Serialization.XmlTextAttribute()]
    > > > public string[] Text;
    > > > }
    > > > }
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >

    >
    >
    Dino Chiesa [Microsoft], Jun 21, 2004
    #8
  9. Zihong Lu

    Zihong Lu Guest

    Dino,

    Yes I did search the axis-users group for days before I came to asking for
    help in this group. For some reason the solution they provide there don't
    work for me.

    You are right that from axis server side, I need to hand craft the skeleton
    codes/settings before I can use the session handler, and I did manage to
    overcome the problem on that side.

    Back to the issue here. I have been experimenting further, by modifying the
    wsdl file namespace. Then, magically, the getSession() function call
    succeeded. From that point view, the xsi:type may not be an issue.

    But, problems are not finished yet, the subsequent call closeSession() from
    the .bet client does not have the sessionID included in the header. This is
    the .net->axis request for closeSession() after the getSession() call:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <closeSession xmlns="urn:myname.com" />
    </soap:Body>
    </soap:Envelope>

    Any idea?


    Here is the modified WSDL:
    ========================================
    <?xml version="1.0" encoding="UTF-8" ?>
    <wsdl:definitions targetNamespace="urn:myname.com"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    xmlns:impl="urn:myname.com"
    xmlns:intf="urn:myname.com"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:sens="http://xml.apache.org/axis/session">

    <wsdl:types>

    <schema targetNamespace="urn:myname.com"
    xmlns="http://www.w3.org/2001/XMLSchema">

    <element name="sessionID" type="impl:session" />
    <complexType name="session">
    <sequence>
    <element minOccurs="1" maxOccurs="1" name="id" type="xsd:long" />
    </sequence>
    </complexType>

    <element name="getSession">
    <complexType>
    <sequence>
    <element name="username" type="xsd:string" />
    <element name="password" type="xsd:string" />
    </sequence>
    </complexType>
    </element>

    <element name="getSessionResponse">
    <complexType>
    <sequence>
    <element name="getSessionReturn" type="xsd:string"
    form="qualified" />
    </sequence>
    </complexType>
    </element>

    <element name="closeSession">
    <complexType />
    </element>

    <element name="closeSessionResponse">
    <complexType />
    </element>

    </schema>
    </wsdl:types>

    <wsdl:message name="soapHeader">
    <wsdl:part name="sessionID" element="impl:sessionID" />
    </wsdl:message>

    <wsdl:message name="getSessionRequest">
    <wsdl:part element="impl:getSession" name="parameters" />
    </wsdl:message>

    <wsdl:message name="getSessionResponse">
    <wsdl:part element="impl:getSessionResponse" name="parameters" />
    </wsdl:message>

    <wsdl:message name="closeSessionRequest">
    <wsdl:part element="impl:closeSession" name="parameters" />
    </wsdl:message>

    <wsdl:message name="closeSessionResponse">
    <wsdl:part element="impl:closeSessionResponse" name="parameters" />
    </wsdl:message>

    <wsdl:portType name="MynameService">

    <wsdl:eek:peration name="getSession" parameterOrder="">
    <wsdl:input message="impl:getSessionRequest"
    name="getSessionRequest" />
    <wsdl:eek:utput message="impl:getSessionResponse"
    name="getSessionResponse" />
    </wsdl:eek:peration>

    <wsdl:eek:peration name="closeSession">
    <wsdl:input message="impl:closeSessionRequest"
    name="closeSessionRequest" />
    <wsdl:eek:utput message="impl:closeSessionResponse"
    name="closeSessionResponse" />
    </wsdl:eek:peration>

    </wsdl:portType>


    <wsdl:binding name="MynameServiceSoapBinding" type="impl:MynameService">
    <wsdlsoap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:eek:peration name="getSession">
    <wsdlsoap:eek:peration soapAction="" />
    <wsdl:input name="getSessionRequest">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:input>
    <wsdl:eek:utput name="getSessionResponse">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:eek:utput>
    </wsdl:eek:peration>

    <wsdl:eek:peration name="closeSession">
    <wsdlsoap:eek:peration soapAction="" />
    <wsdl:input name="closeSessionRequest">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:input>
    <wsdl:eek:utput name="closeSessionResponse">
    <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    use="literal"/>
    <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    </wsdl:eek:utput>
    </wsdl:eek:peration>

    </wsdl:binding>

    <wsdl:service name="MynameServiceService">
    <wsdl:port binding="impl:MynameServiceSoapBinding" name="MynameService">
    <wsdlsoap:address
    location="http://localhost:8080/services/MynameService" />
    </wsdl:port>
    </wsdl:service>

    </wsdl:definitions>
    ====================================

    This is the created client proxy:

    namespace MyNameSpace{

    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="MynameServiceSoapBindi
    ng", Namespace="urn:myname.com")]

    public class MynameServiceService :
    System.Web.Services.Protocols.SoapHttpClientProtocol {


    public session sessionID;


    /// <remarks/>

    public MynameServiceService() {

    this.Url = "http://localhost:8080/services/MynameService";

    }


    /// <remarks/>

    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    [return: System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]

    public string
    getSession([System.Xml.Serialization.XmlElementdttribute(Form=System.Xml.Sch
    ema.XmlSchemaForm.Unqualified)] string username,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)] string password) {

    object[] results = this.Invoke("getSession", new object[] {

    username,

    password});

    return ((string)(results[0]));

    }


    /// <remarks/>

    public System.IAsyncResult BegingetSession(string username, string password,
    System.AsyncCallback callback, object asyncState) {

    return this.BeginInvoke("getSession", new object[] {

    username,

    password}, callback, asyncState);

    }


    /// <remarks/>

    public string EndgetSession(System.IAsyncResult asyncResult) {

    object[] results = this.EndInvoke(asyncResult);

    return ((string)(results[0]));

    }


    /// <remarks/>

    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    public void closeSession() {

    this.Invoke("closeSession", new object[0]);

    }


    /// <remarks/>

    public System.IAsyncResult BegincloseSession(System.AsyncCallback callback,
    object asyncState) {

    return this.BeginInvoke("closeSession", new object[0], callback,
    asyncState);

    }


    /// <remarks/>

    public void EndcloseSession(System.IAsyncResult asyncResult) {

    this.EndInvoke(asyncResult);

    }

    }


    /// <remarks/>

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:myname.com")]

    [System.Xml.Serialization.XmlRootAttribute("sessionID",
    Namespace="urn:myname.com", IsNullable=false)]

    public class session : System.Web.Services.Protocols.SoapHeader {


    /// <remarks/>

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)]

    public long id;

    }

    }






    "Dino Chiesa [Microsoft]" <> wrote in message
    news:%...
    > yes, I think you are correct. the xsi:type="xsd:long" seems to be
    > incorrect.
    >
    > BUT!
    >
    > We are changing the WSDL here without modifying the server. The WSDL
    > documents how we would like the service to appear, but if we design the

    WSDL
    > independently of the implementation of the service (in AXIS) , then there

    is
    > no way of knowing if the two independent things coincide.
    >
    >
    > It appears that AXIS is using doc/literal for the SOAP body and
    > soap-section-5 encoded for the SOAP header. Can you check this in the
    > server/service implementation?
    >
    > --------------------
    >
    > It seems like you may be using the AXIS SimpleSessionHandler ? If so,
    > there are others who have tried to get this to work and had troubles, for
    > example see the axis user mailing list archive, eg
    > http://marc.theaimsgroup.com/?l=axis-user&m=107694009529949&w=2
    >
    > or
    > http://marc.theaimsgroup.com/?l=axis-user&m=104204463001241&w=2
    >
    > or to search the archive:
    > http://marc.theaimsgroup.com/?l=axis-user&w=2&r=1&s=sessionhandler&q=b
    >
    >
    > The problem is that AXIS's WSDL2Java tool does not handle soapheaders as
    > defined in WSDL. If you have a WSDL (such as you have constructed here)
    > that specifies a soapheader to be used in the input message, the output
    > message, or both, then the Java implementation generated from AXIS'
    > "wsdl2java --server-side" does not have any support for that header. As a
    > developer using AXIS, you need to provide a handler to extract the

    header,
    > or insert the header, as appropriate.
    >
    > The "SimpleSessionHandler" code included with AXIS v1.1 shows this. As

    you
    > can see, there is some DOM walking you have to do to extract the header

    and
    > de-marshal it and validate it and so on. I suppose there is similar work
    > you have to do to "add" the header to the response.
    >
    > But even with all this I am not sure why the header would be section-5
    > encoded when the body is not. In the WSDL model, the soap body can in
    > fact be a different "use" than the header. In other words the literal or
    > section-5 encoded is specified on the body independently from the header.
    > Eg,
    >
    > <wsdl:eek:utput name="getSessionResponse">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:eek:utput>
    >
    >
    >
    > -Dino
    >
    >
    >
    > "Zihong Lu" <> wrote in message
    > news:...
    > > Dino,
    > >
    > > I have changed the session declaration in WSDL to what you suggested,

    as
    > > showing here:
    > >
    > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > <element name="sessionID" type="sens:session"/>
    > > <complexType name="session">
    > > <sequence>
    > > <element minOccurs="1" maxOccurs="1" name="id"

    > type="xsd:long"/>
    > > </sequence>
    > > </complexType>
    > > </schema>
    > >
    > > where namespace "sens" was defined in the <wsdl:definitions> as
    > > xmlns:sens="http://xml.apache.org/axis/session".
    > >
    > > Yes, the generated proxy code now has the same session class derived

    from
    > > SoapHeader, as earlier. However, compared to the code generated from
    > > simpleType declaration in WSDL earlier , the class memeber "id" now has

    a
    > > data type of long, instead of the earlier string[], and it has a

    sensible
    > > name "id" that I set, instead of the earlier generated name of "Text"

    > (these
    > > are the only changes in the whole generated client proxy file):
    > >
    > > /// <remarks/>
    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > axis/session")]
    > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > public class session : System.Web.Services.Protocols.SoapHeader {
    > >
    > > /// <remarks/>
    > >
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)]
    > > public long id;
    > > }
    > >
    > > I have noticed that the "id" is unqulified, while in the example you

    > showed
    > > the "s" does not have the "Unqualified" attribute.
    > >
    > > However, even with this change, I still got the same error of
    > > InvalidOperationException. Since the wsdl file is manually edited, I

    did
    > > not change Axis server side. For the session handling, I simply use
    > > SimpleSessionHandler handler, a convenient handler that Axis provided.
    > >
    > > I have also tested the code with the "Form = ... Unqualified" manually
    > > removed from the generated proxy code, I still got the same error. The

    > eror
    > > message is copied here again for completeness:
    > > =======================================
    > > Unhandled Exception: System.InvalidOperationException: There is an error

    > in
    > > XML
    > > document (4, 4). ---> System.InvalidOperationException: The specified

    type
    > > was n
    > > ot recognized: name='long',

    namespace='http://www.w3.org/2001/XMLSchema',
    > at
    > > <se
    > > ssionID xmlns='http://xml.apache.org/axis/session'>.
    > > at
    > >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > > 1_session(Boolean isNullable, Boolean checkType)
    > > at
    > >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > > 8_OutHeaders()
    > > =======================================
    > >
    > > The returned SOAP message is
    > > <?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:Header>
    > > <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long"
    > >

    >

    xmlns:ns1="http://xml.apache.org/axis/session">-5227012230670020468</ns1:ses
    > > sionID>
    > > </soapenv:Header>
    > > ...
    > >
    > > the position (4,4) indicated in the error message is the ns1:sessionID

    > tag.
    > > Does this message looks right to you, compared to what WSDL declared?
    > > Somehow I felt the xsi:type="xsd:long" is not right, since dot/lit style
    > > don't usually have this.
    > >
    > > -Zihong
    > >
    > >
    > >
    > > "Dino Chiesa [Microsoft]" <> wrote in message
    > > news:%...
    > > > If I modify your WSDL to type the session ID this way:
    > > >
    > > > <element name="sessionID" type="sess:session"/>
    > > >
    > > > <complexType name="session">
    > > > <sequence>
    > > > <element minOccurs="1" maxOccurs="1" name="s"

    > > type="xsd:long"/>
    > > > </sequence>
    > > > </complexType>
    > > >
    > > >
    > > > it works, and generates a header class like so:
    > > >
    > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > > /// <remarks/>
    > > > [System.Xml.Serialization.XmlElementAttribute()]
    > > > public long s;
    > > > }
    > > >
    > > >
    > > > I think the problem is, in .NET the soapheader must derive from
    > > > System.Web.Services.Protocols.SoapHeader . In other words it is a
    > > > complexType. In your WSDL you have it as a simpleType. Generating a

    > > client
    > > > proxy from that WSDL results in some confusion. Feels like a bug in

    the
    > > > wsdl.exe compiler.
    > > >
    > > > The simple fix is to change the definition of the header type in XSD

    to
    > > the
    > > > above. This generates what you would expect, I think.
    > > >
    > > > But you have to ensure this synchronizes with the AXIS server. If you

    > are
    > > > generating the server from the WSDL then it should be no problem .
    > > >
    > > > -Dino
    > > >
    > > >
    > > >
    > > >
    > > > "Zihong Lu" <> wrote in message
    > > > news:%...
    > > > > Dino,
    > > > >
    > > > > Thanks. That works.
    > > > >
    > > > > Now I have a second issue: the soap header. As you can see from my
    > > > eariler
    > > > > wsdl file, if I do the following:
    > > > > (1) changed the line to <element name="getSessionReturn"
    > > > type="xsd:string"
    > > > > form="qualified"/>, to solve the null result problem;
    > > > > (2) uncommented out the line to indicate the soap header in the

    return
    > > > > message:
    > > > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"

    > > use="literal"
    > > > > />
    > > > >
    > > > > When invoke the getSession() call, the .net client complained:
    > > > >
    > > > > =========================================
    > > > > System.InvalidOperationException: The specified type was not

    > recognized:
    > > > > name='long',
    > > > > namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    > > > > xmlns='http://xml.apache.org/axis/session'>.
    > > > >
    > > > > at
    > > > >
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    > > > > session(Boolean isNullable, Boolean checkType)
    > > > > at
    > > > >
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    > > > > OutHeaders()
    > > > >
    > > > > Do I need to create serializer/deserializer for the SOAP header? I
    > > > thought
    > > > > the created proxy code already recognize it and can serialize it
    > > > > automatically, like gSoap does.
    > > > >
    > > > > Here is the new generated client proxy:
    > > > > ============================
    > > > > namespace MyNameSpace{
    > > > > 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="MynameServiceSoapBindi
    > > > > ng", Namespace="urn:myname.com")]
    > > > > public class MynameServiceService :
    > > > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > > > >
    > > > > public session sessionID;
    > > > >
    > > > > /// <remarks/>
    > > > > public MynameServiceService() {
    > > > > this.Url =

    "http://localhost:8080/services/MynameService";
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > >

    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > >

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > > RequestNamespace="urn:myname.com",

    ResponseNamespace="urn:myname.com",
    > > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > > >

    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > > [return:
    > > > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > > > > public string
    > > > >
    > > >

    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > > > ema.XmlSchemaForm.Unqualified)] string username,
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > > maForm.Unqualified)] string password) {
    > > > > object[] results = this.Invoke("getSession", new

    object[]
    > {
    > > > > username,
    > > > > password});
    > > > > return ((string)(results[0]));
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > > public System.IAsyncResult BegingetSession(string username,

    > > string
    > > > > password, System.AsyncCallback callback, object asyncState) {
    > > > > return this.BeginInvoke("getSession", new object[] {
    > > > > username,
    > > > > password}, callback, asyncState);
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > > public string EndgetSession(System.IAsyncResult asyncResult)

    {
    > > > > object[] results = this.EndInvoke(asyncResult);
    > > > > return ((string)(results[0]));
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > >

    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > >

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > > RequestNamespace="urn:myname.com",

    ResponseNamespace="urn:myname.com",
    > > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > > >

    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > > public void closeSession() {
    > > > > this.Invoke("closeSession", new object[0]);
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > > public System.IAsyncResult

    > > BegincloseSession(System.AsyncCallback
    > > > > callback, object asyncState) {
    > > > > return this.BeginInvoke("closeSession", new object[0],
    > > > callback,
    > > > > asyncState);
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > > public void EndcloseSession(System.IAsyncResult asyncResult)

    {
    > > > > this.EndInvoke(asyncResult);
    > > > > }
    > > > > }
    > > > >
    > > > > /// <remarks/>
    > > > >
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > > axis/session")]
    > > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > > > public class session : System.Web.Services.Protocols.SoapHeader

    {
    > > > >
    > > > > /// <remarks/>
    > > > > [System.Xml.Serialization.XmlTextAttribute()]
    > > > > public string[] Text;
    > > > > }
    > > > > }
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >

    >
    >
    Zihong Lu, Jun 22, 2004
    #9
  10. Zihong Lu

    Zihong Lu Guest

    I believe my approach is wrong. Because the element type "sessionID" is
    defined in the "impl" namespace, ie, the urn:myname.com namespace, which
    means that upon return in getSession() call, the .net client will look for
    the sessionID in the urn:myname.com namespace. However, in the return
    message, axis sends the header in the http://xml.apache.org/axis/session
    namespace, as shown here for axis->.net response to getSession():

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    <soapenv:Header>
    <ns2:sessionID soapenv:mustUnderstand="0" xsi:type="ns1:long"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns1="http://www.w3.org/2001/XMLSchema"

    xmlns:ns2="http://xml.apache.org/axis/session">-3876663609367995448</ns2:ses
    sionID>
    </soapenv:Header>
    <soapenv:Body>
    <getSessionResponse xmlns="urn:myname.com">
    <getSessionReturn>-3876663609367995448</getSessionReturn>
    </getSessionResponse>
    </soapenv:Body>
    </soapenv:Envelope>


    since .net did not find anything in the urn:myname.com namespace, it simply
    ignore the header, hence the getSession() call returned nicely, no error.
    However, it did not get the session ID in the header either, hence, no
    session ID in the subsequent closeSession() call.

    Well, back to the same problem.

    -Zihong

    "Zihong Lu" <> wrote in message
    news:ODrL7l$...
    > Dino,
    >
    > Yes I did search the axis-users group for days before I came to asking for
    > help in this group. For some reason the solution they provide there don't
    > work for me.
    >
    > You are right that from axis server side, I need to hand craft the

    skeleton
    > codes/settings before I can use the session handler, and I did manage to
    > overcome the problem on that side.
    >
    > Back to the issue here. I have been experimenting further, by modifying

    the
    > wsdl file namespace. Then, magically, the getSession() function call
    > succeeded. From that point view, the xsi:type may not be an issue.
    >
    > But, problems are not finished yet, the subsequent call closeSession()

    from
    > the .bet client does not have the sessionID included in the header. This

    is
    > the .net->axis request for closeSession() after the getSession() call:
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > <soap:Body>
    > <closeSession xmlns="urn:myname.com" />
    > </soap:Body>
    > </soap:Envelope>
    >
    > Any idea?
    >
    >
    > Here is the modified WSDL:
    > ========================================
    > <?xml version="1.0" encoding="UTF-8" ?>
    > <wsdl:definitions targetNamespace="urn:myname.com"
    > xmlns="http://schemas.xmlsoap.org/wsdl/"
    > xmlns:apachesoap="http://xml.apache.org/xml-soap"
    > xmlns:impl="urn:myname.com"
    > xmlns:intf="urn:myname.com"
    > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:sens="http://xml.apache.org/axis/session">
    >
    > <wsdl:types>
    >
    > <schema targetNamespace="urn:myname.com"
    > xmlns="http://www.w3.org/2001/XMLSchema">
    >
    > <element name="sessionID" type="impl:session" />
    > <complexType name="session">
    > <sequence>
    > <element minOccurs="1" maxOccurs="1" name="id" type="xsd:long" />
    > </sequence>
    > </complexType>
    >
    > <element name="getSession">
    > <complexType>
    > <sequence>
    > <element name="username" type="xsd:string" />
    > <element name="password" type="xsd:string" />
    > </sequence>
    > </complexType>
    > </element>
    >
    > <element name="getSessionResponse">
    > <complexType>
    > <sequence>
    > <element name="getSessionReturn" type="xsd:string"
    > form="qualified" />
    > </sequence>
    > </complexType>
    > </element>
    >
    > <element name="closeSession">
    > <complexType />
    > </element>
    >
    > <element name="closeSessionResponse">
    > <complexType />
    > </element>
    >
    > </schema>
    > </wsdl:types>
    >
    > <wsdl:message name="soapHeader">
    > <wsdl:part name="sessionID" element="impl:sessionID" />
    > </wsdl:message>
    >
    > <wsdl:message name="getSessionRequest">
    > <wsdl:part element="impl:getSession" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:message name="getSessionResponse">
    > <wsdl:part element="impl:getSessionResponse" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:message name="closeSessionRequest">
    > <wsdl:part element="impl:closeSession" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:message name="closeSessionResponse">
    > <wsdl:part element="impl:closeSessionResponse" name="parameters" />
    > </wsdl:message>
    >
    > <wsdl:portType name="MynameService">
    >
    > <wsdl:eek:peration name="getSession" parameterOrder="">
    > <wsdl:input message="impl:getSessionRequest"
    > name="getSessionRequest" />
    > <wsdl:eek:utput message="impl:getSessionResponse"
    > name="getSessionResponse" />
    > </wsdl:eek:peration>
    >
    > <wsdl:eek:peration name="closeSession">
    > <wsdl:input message="impl:closeSessionRequest"
    > name="closeSessionRequest" />
    > <wsdl:eek:utput message="impl:closeSessionResponse"
    > name="closeSessionResponse" />
    > </wsdl:eek:peration>
    >
    > </wsdl:portType>
    >
    >
    > <wsdl:binding name="MynameServiceSoapBinding" type="impl:MynameService">
    > <wsdlsoap:binding style="document"
    > transport="http://schemas.xmlsoap.org/soap/http" />
    >
    > <wsdl:eek:peration name="getSession">
    > <wsdlsoap:eek:peration soapAction="" />
    > <wsdl:input name="getSessionRequest">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:input>
    > <wsdl:eek:utput name="getSessionResponse">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:eek:utput>
    > </wsdl:eek:peration>
    >
    > <wsdl:eek:peration name="closeSession">
    > <wsdlsoap:eek:peration soapAction="" />
    > <wsdl:input name="closeSessionRequest">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:input>
    > <wsdl:eek:utput name="closeSessionResponse">
    > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > use="literal"/>
    > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > </wsdl:eek:utput>
    > </wsdl:eek:peration>
    >
    > </wsdl:binding>
    >
    > <wsdl:service name="MynameServiceService">
    > <wsdl:port binding="impl:MynameServiceSoapBinding"

    name="MynameService">
    > <wsdlsoap:address
    > location="http://localhost:8080/services/MynameService" />
    > </wsdl:port>
    > </wsdl:service>
    >
    > </wsdl:definitions>
    > ====================================
    >
    > This is the created client proxy:
    >
    > namespace MyNameSpace{
    >
    > 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="MynameServiceSoapBindi
    > ng", Namespace="urn:myname.com")]
    >
    > public class MynameServiceService :
    > System.Web.Services.Protocols.SoapHttpClientProtocol {
    >
    >
    > public session sessionID;
    >
    >
    > /// <remarks/>
    >
    > public MynameServiceService() {
    >
    > this.Url = "http://localhost:8080/services/MynameService";
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    >
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    >
    > [return: System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    >
    > public string
    >

    getSession([System.Xml.Serialization.XmlElementdttribute(Form=System.Xml.Sch
    > ema.XmlSchemaForm.Unqualified)] string username,
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)] string password) {
    >
    > object[] results = this.Invoke("getSession", new object[] {
    >
    > username,
    >
    > password});
    >
    > return ((string)(results[0]));
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > public System.IAsyncResult BegingetSession(string username, string

    password,
    > System.AsyncCallback callback, object asyncState) {
    >
    > return this.BeginInvoke("getSession", new object[] {
    >
    > username,
    >
    > password}, callback, asyncState);
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > public string EndgetSession(System.IAsyncResult asyncResult) {
    >
    > object[] results = this.EndInvoke(asyncResult);
    >
    > return ((string)(results[0]));
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    >
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    >
    > public void closeSession() {
    >
    > this.Invoke("closeSession", new object[0]);
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > public System.IAsyncResult BegincloseSession(System.AsyncCallback

    callback,
    > object asyncState) {
    >
    > return this.BeginInvoke("closeSession", new object[0], callback,
    > asyncState);
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > public void EndcloseSession(System.IAsyncResult asyncResult) {
    >
    > this.EndInvoke(asyncResult);
    >
    > }
    >
    > }
    >
    >
    > /// <remarks/>
    >
    > [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:myname.com")]
    >
    > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > Namespace="urn:myname.com", IsNullable=false)]
    >
    > public class session : System.Web.Services.Protocols.SoapHeader {
    >
    >
    > /// <remarks/>
    >
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)]
    >
    > public long id;
    >
    > }
    >
    > }
    >
    >
    >
    >
    >
    >
    > "Dino Chiesa [Microsoft]" <> wrote in message
    > news:%...
    > > yes, I think you are correct. the xsi:type="xsd:long" seems to be
    > > incorrect.
    > >
    > > BUT!
    > >
    > > We are changing the WSDL here without modifying the server. The WSDL
    > > documents how we would like the service to appear, but if we design the

    > WSDL
    > > independently of the implementation of the service (in AXIS) , then

    there
    > is
    > > no way of knowing if the two independent things coincide.
    > >
    > >
    > > It appears that AXIS is using doc/literal for the SOAP body and
    > > soap-section-5 encoded for the SOAP header. Can you check this in the
    > > server/service implementation?
    > >
    > > --------------------
    > >
    > > It seems like you may be using the AXIS SimpleSessionHandler ? If so,
    > > there are others who have tried to get this to work and had troubles,

    for
    > > example see the axis user mailing list archive, eg
    > > http://marc.theaimsgroup.com/?l=axis-user&m=107694009529949&w=2
    > >
    > > or
    > > http://marc.theaimsgroup.com/?l=axis-user&m=104204463001241&w=2
    > >
    > > or to search the archive:
    > > http://marc.theaimsgroup.com/?l=axis-user&w=2&r=1&s=sessionhandler&q=b
    > >
    > >
    > > The problem is that AXIS's WSDL2Java tool does not handle soapheaders as
    > > defined in WSDL. If you have a WSDL (such as you have constructed here)
    > > that specifies a soapheader to be used in the input message, the output
    > > message, or both, then the Java implementation generated from AXIS'
    > > "wsdl2java --server-side" does not have any support for that header. As

    a
    > > developer using AXIS, you need to provide a handler to extract the

    > header,
    > > or insert the header, as appropriate.
    > >
    > > The "SimpleSessionHandler" code included with AXIS v1.1 shows this. As

    > you
    > > can see, there is some DOM walking you have to do to extract the header

    > and
    > > de-marshal it and validate it and so on. I suppose there is similar

    work
    > > you have to do to "add" the header to the response.
    > >
    > > But even with all this I am not sure why the header would be section-5
    > > encoded when the body is not. In the WSDL model, the soap body can in
    > > fact be a different "use" than the header. In other words the literal or
    > > section-5 encoded is specified on the body independently from the

    header.
    > > Eg,
    > >
    > > <wsdl:eek:utput name="getSessionResponse">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:eek:utput>
    > >
    > >
    > >
    > > -Dino
    > >
    > >
    > >
    > > "Zihong Lu" <> wrote in message
    > > news:...
    > > > Dino,
    > > >
    > > > I have changed the session declaration in WSDL to what you suggested,

    > as
    > > > showing here:
    > > >
    > > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > > <element name="sessionID" type="sens:session"/>
    > > > <complexType name="session">
    > > > <sequence>
    > > > <element minOccurs="1" maxOccurs="1" name="id"

    > > type="xsd:long"/>
    > > > </sequence>
    > > > </complexType>
    > > > </schema>
    > > >
    > > > where namespace "sens" was defined in the <wsdl:definitions> as
    > > > xmlns:sens="http://xml.apache.org/axis/session".
    > > >
    > > > Yes, the generated proxy code now has the same session class derived

    > from
    > > > SoapHeader, as earlier. However, compared to the code generated from
    > > > simpleType declaration in WSDL earlier , the class memeber "id" now

    has
    > a
    > > > data type of long, instead of the earlier string[], and it has a

    > sensible
    > > > name "id" that I set, instead of the earlier generated name of "Text"

    > > (these
    > > > are the only changes in the whole generated client proxy file):
    > > >
    > > > /// <remarks/>
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > axis/session")]
    > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > >
    > > > /// <remarks/>
    > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > maForm.Unqualified)]
    > > > public long id;
    > > > }
    > > >
    > > > I have noticed that the "id" is unqulified, while in the example you

    > > showed
    > > > the "s" does not have the "Unqualified" attribute.
    > > >
    > > > However, even with this change, I still got the same error of
    > > > InvalidOperationException. Since the wsdl file is manually edited, I

    > did
    > > > not change Axis server side. For the session handling, I simply use
    > > > SimpleSessionHandler handler, a convenient handler that Axis provided.
    > > >
    > > > I have also tested the code with the "Form = ... Unqualified"

    manually
    > > > removed from the generated proxy code, I still got the same error.

    The
    > > eror
    > > > message is copied here again for completeness:
    > > > =======================================
    > > > Unhandled Exception: System.InvalidOperationException: There is an

    error
    > > in
    > > > XML
    > > > document (4, 4). ---> System.InvalidOperationException: The specified

    > type
    > > > was n
    > > > ot recognized: name='long',

    > namespace='http://www.w3.org/2001/XMLSchema',
    > > at
    > > > <se
    > > > ssionID xmlns='http://xml.apache.org/axis/session'>.
    > > > at
    > > >

    > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > > > 1_session(Boolean isNullable, Boolean checkType)
    > > > at
    > > >

    > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > > > 8_OutHeaders()
    > > > =======================================
    > > >
    > > > The returned SOAP message is
    > > > <?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:Header>
    > > > <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long"
    > > >

    > >

    >

    xmlns:ns1="http://xml.apache.org/axis/session">-5227012230670020468</ns1:ses
    > > > sionID>
    > > > </soapenv:Header>
    > > > ...
    > > >
    > > > the position (4,4) indicated in the error message is the ns1:sessionID

    > > tag.
    > > > Does this message looks right to you, compared to what WSDL declared?
    > > > Somehow I felt the xsi:type="xsd:long" is not right, since dot/lit

    style
    > > > don't usually have this.
    > > >
    > > > -Zihong
    > > >
    > > >
    > > >
    > > > "Dino Chiesa [Microsoft]" <> wrote in

    message
    > > > news:%...
    > > > > If I modify your WSDL to type the session ID this way:
    > > > >
    > > > > <element name="sessionID" type="sess:session"/>
    > > > >
    > > > > <complexType name="session">
    > > > > <sequence>
    > > > > <element minOccurs="1" maxOccurs="1" name="s"
    > > > type="xsd:long"/>
    > > > > </sequence>
    > > > > </complexType>
    > > > >
    > > > >
    > > > > it works, and generates a header class like so:
    > > > >
    > > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > > > /// <remarks/>
    > > > > [System.Xml.Serialization.XmlElementAttribute()]
    > > > > public long s;
    > > > > }
    > > > >
    > > > >
    > > > > I think the problem is, in .NET the soapheader must derive from
    > > > > System.Web.Services.Protocols.SoapHeader . In other words it is a
    > > > > complexType. In your WSDL you have it as a simpleType. Generating

    a
    > > > client
    > > > > proxy from that WSDL results in some confusion. Feels like a bug in

    > the
    > > > > wsdl.exe compiler.
    > > > >
    > > > > The simple fix is to change the definition of the header type in XSD

    > to
    > > > the
    > > > > above. This generates what you would expect, I think.
    > > > >
    > > > > But you have to ensure this synchronizes with the AXIS server. If

    you
    > > are
    > > > > generating the server from the WSDL then it should be no problem .
    > > > >
    > > > > -Dino
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Zihong Lu" <> wrote in message
    > > > > news:%...
    > > > > > Dino,
    > > > > >
    > > > > > Thanks. That works.
    > > > > >
    > > > > > Now I have a second issue: the soap header. As you can see from

    my
    > > > > eariler
    > > > > > wsdl file, if I do the following:
    > > > > > (1) changed the line to <element name="getSessionReturn"
    > > > > type="xsd:string"
    > > > > > form="qualified"/>, to solve the null result problem;
    > > > > > (2) uncommented out the line to indicate the soap header in the

    > return
    > > > > > message:
    > > > > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > > use="literal"
    > > > > > />
    > > > > >
    > > > > > When invoke the getSession() call, the .net client complained:
    > > > > >
    > > > > > =========================================
    > > > > > System.InvalidOperationException: The specified type was not

    > > recognized:
    > > > > > name='long',
    > > > > > namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    > > > > > xmlns='http://xml.apache.org/axis/session'>.
    > > > > >
    > > > > > at
    > > > > >
    > > > >
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    > > > > > session(Boolean isNullable, Boolean checkType)
    > > > > > at
    > > > > >
    > > > >
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    > > > > > OutHeaders()
    > > > > >
    > > > > > Do I need to create serializer/deserializer for the SOAP header?

    I
    > > > > thought
    > > > > > the created proxy code already recognize it and can serialize it
    > > > > > automatically, like gSoap does.
    > > > > >
    > > > > > Here is the new generated client proxy:
    > > > > > ============================
    > > > > > namespace MyNameSpace{
    > > > > > 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="MynameServiceSoapBindi
    > > > > > ng", Namespace="urn:myname.com")]
    > > > > > public class MynameServiceService :
    > > > > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > > > > >
    > > > > > public session sessionID;
    > > > > >
    > > > > > /// <remarks/>
    > > > > > public MynameServiceService() {
    > > > > > this.Url =

    > "http://localhost:8080/services/MynameService";
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > >

    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > > >

    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > > >

    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > > > RequestNamespace="urn:myname.com",

    > ResponseNamespace="urn:myname.com",
    > > > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > > > >
    > > >

    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > > > [return:
    > > > > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > > > > > public string
    > > > > >
    > > > >
    > > >

    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > > > > ema.XmlSchemaForm.Unqualified)] string username,
    > > > > >
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > > > maForm.Unqualified)] string password) {
    > > > > > object[] results = this.Invoke("getSession", new

    > object[]
    > > {
    > > > > > username,
    > > > > > password});
    > > > > > return ((string)(results[0]));
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > > public System.IAsyncResult BegingetSession(string

    username,
    > > > string
    > > > > > password, System.AsyncCallback callback, object asyncState) {
    > > > > > return this.BeginInvoke("getSession", new object[] {
    > > > > > username,
    > > > > > password}, callback, asyncState);
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > > public string EndgetSession(System.IAsyncResult

    asyncResult)
    > {
    > > > > > object[] results = this.EndInvoke(asyncResult);
    > > > > > return ((string)(results[0]));
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > >

    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > > >

    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > > >

    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > > > RequestNamespace="urn:myname.com",

    > ResponseNamespace="urn:myname.com",
    > > > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > > > >
    > > >

    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > > > public void closeSession() {
    > > > > > this.Invoke("closeSession", new object[0]);
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > > public System.IAsyncResult
    > > > BegincloseSession(System.AsyncCallback
    > > > > > callback, object asyncState) {
    > > > > > return this.BeginInvoke("closeSession", new object[0],
    > > > > callback,
    > > > > > asyncState);
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > > public void EndcloseSession(System.IAsyncResult

    asyncResult)
    > {
    > > > > > this.EndInvoke(asyncResult);
    > > > > > }
    > > > > > }
    > > > > >
    > > > > > /// <remarks/>
    > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > > > axis/session")]
    > > > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > > > > public class session :

    System.Web.Services.Protocols.SoapHeader
    > {
    > > > > >
    > > > > > /// <remarks/>
    > > > > > [System.Xml.Serialization.XmlTextAttribute()]
    > > > > > public string[] Text;
    > > > > > }
    > > > > > }
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Zihong Lu, Jun 22, 2004
    #10
  11. why do you not define your session type (in the WSDL) to be in the proper
    namespace?

    eg

    <schema
    targetNamespace="http://xml.apache.org/axis/session"
    xmlns="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    >

    <element name="sessionID" type="sess:session"/>

    <complexType name="session">
    <sequence>
    <element minOccurs="1" maxOccurs="1" name="id" type="xsd:long"/>
    </sequence>
    </complexType>

    </schema>

    Does this not work?


    "Zihong Lu" <> wrote in message
    news:...
    > I believe my approach is wrong. Because the element type "sessionID" is
    > defined in the "impl" namespace, ie, the urn:myname.com namespace, which
    > means that upon return in getSession() call, the .net client will look for
    > the sessionID in the urn:myname.com namespace. However, in the return
    > message, axis sends the header in the http://xml.apache.org/axis/session
    > namespace, as shown here for axis->.net response to getSession():
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <soapenv:Envelope

    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    > <soapenv:Header>
    > <ns2:sessionID soapenv:mustUnderstand="0" xsi:type="ns1:long"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xmlns:ns1="http://www.w3.org/2001/XMLSchema"
    >
    >

    xmlns:ns2="http://xml.apache.org/axis/session">-3876663609367995448</ns2:ses
    > sionID>
    > </soapenv:Header>
    > <soapenv:Body>
    > <getSessionResponse xmlns="urn:myname.com">
    > <getSessionReturn>-3876663609367995448</getSessionReturn>
    > </getSessionResponse>
    > </soapenv:Body>
    > </soapenv:Envelope>
    >
    >
    > since .net did not find anything in the urn:myname.com namespace, it

    simply
    > ignore the header, hence the getSession() call returned nicely, no error.
    > However, it did not get the session ID in the header either, hence, no
    > session ID in the subsequent closeSession() call.
    >
    > Well, back to the same problem.
    >
    > -Zihong
    >
    > "Zihong Lu" <> wrote in message
    > news:ODrL7l$...
    > > Dino,
    > >
    > > Yes I did search the axis-users group for days before I came to asking

    for
    > > help in this group. For some reason the solution they provide there

    don't
    > > work for me.
    > >
    > > You are right that from axis server side, I need to hand craft the

    > skeleton
    > > codes/settings before I can use the session handler, and I did manage to
    > > overcome the problem on that side.
    > >
    > > Back to the issue here. I have been experimenting further, by modifying

    > the
    > > wsdl file namespace. Then, magically, the getSession() function call
    > > succeeded. From that point view, the xsi:type may not be an issue.
    > >
    > > But, problems are not finished yet, the subsequent call closeSession()

    > from
    > > the .bet client does not have the sessionID included in the header.

    This
    > is
    > > the .net->axis request for closeSession() after the getSession() call:
    > >
    > > <?xml version="1.0" encoding="utf-8"?>
    > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > > <soap:Body>
    > > <closeSession xmlns="urn:myname.com" />
    > > </soap:Body>
    > > </soap:Envelope>
    > >
    > > Any idea?
    > >
    > >
    > > Here is the modified WSDL:
    > > ========================================
    > > <?xml version="1.0" encoding="UTF-8" ?>
    > > <wsdl:definitions targetNamespace="urn:myname.com"
    > > xmlns="http://schemas.xmlsoap.org/wsdl/"
    > > xmlns:apachesoap="http://xml.apache.org/xml-soap"
    > > xmlns:impl="urn:myname.com"
    > > xmlns:intf="urn:myname.com"
    > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > > xmlns:sens="http://xml.apache.org/axis/session">
    > >
    > > <wsdl:types>
    > >
    > > <schema targetNamespace="urn:myname.com"
    > > xmlns="http://www.w3.org/2001/XMLSchema">
    > >
    > > <element name="sessionID" type="impl:session" />
    > > <complexType name="session">
    > > <sequence>
    > > <element minOccurs="1" maxOccurs="1" name="id" type="xsd:long"

    />
    > > </sequence>
    > > </complexType>
    > >
    > > <element name="getSession">
    > > <complexType>
    > > <sequence>
    > > <element name="username" type="xsd:string" />
    > > <element name="password" type="xsd:string" />
    > > </sequence>
    > > </complexType>
    > > </element>
    > >
    > > <element name="getSessionResponse">
    > > <complexType>
    > > <sequence>
    > > <element name="getSessionReturn" type="xsd:string"
    > > form="qualified" />
    > > </sequence>
    > > </complexType>
    > > </element>
    > >
    > > <element name="closeSession">
    > > <complexType />
    > > </element>
    > >
    > > <element name="closeSessionResponse">
    > > <complexType />
    > > </element>
    > >
    > > </schema>
    > > </wsdl:types>
    > >
    > > <wsdl:message name="soapHeader">
    > > <wsdl:part name="sessionID" element="impl:sessionID" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="getSessionRequest">
    > > <wsdl:part element="impl:getSession" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="getSessionResponse">
    > > <wsdl:part element="impl:getSessionResponse" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="closeSessionRequest">
    > > <wsdl:part element="impl:closeSession" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:message name="closeSessionResponse">
    > > <wsdl:part element="impl:closeSessionResponse" name="parameters" />
    > > </wsdl:message>
    > >
    > > <wsdl:portType name="MynameService">
    > >
    > > <wsdl:eek:peration name="getSession" parameterOrder="">
    > > <wsdl:input message="impl:getSessionRequest"
    > > name="getSessionRequest" />
    > > <wsdl:eek:utput message="impl:getSessionResponse"
    > > name="getSessionResponse" />
    > > </wsdl:eek:peration>
    > >
    > > <wsdl:eek:peration name="closeSession">
    > > <wsdl:input message="impl:closeSessionRequest"
    > > name="closeSessionRequest" />
    > > <wsdl:eek:utput message="impl:closeSessionResponse"
    > > name="closeSessionResponse" />
    > > </wsdl:eek:peration>
    > >
    > > </wsdl:portType>
    > >
    > >
    > > <wsdl:binding name="MynameServiceSoapBinding" type="impl:MynameService">
    > > <wsdlsoap:binding style="document"
    > > transport="http://schemas.xmlsoap.org/soap/http" />
    > >
    > > <wsdl:eek:peration name="getSession">
    > > <wsdlsoap:eek:peration soapAction="" />
    > > <wsdl:input name="getSessionRequest">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:input>
    > > <wsdl:eek:utput name="getSessionResponse">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:eek:utput>
    > > </wsdl:eek:peration>
    > >
    > > <wsdl:eek:peration name="closeSession">
    > > <wsdlsoap:eek:peration soapAction="" />
    > > <wsdl:input name="closeSessionRequest">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:input>
    > > <wsdl:eek:utput name="closeSessionResponse">
    > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > use="literal"/>
    > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > </wsdl:eek:utput>
    > > </wsdl:eek:peration>
    > >
    > > </wsdl:binding>
    > >
    > > <wsdl:service name="MynameServiceService">
    > > <wsdl:port binding="impl:MynameServiceSoapBinding"

    > name="MynameService">
    > > <wsdlsoap:address
    > > location="http://localhost:8080/services/MynameService" />
    > > </wsdl:port>
    > > </wsdl:service>
    > >
    > > </wsdl:definitions>
    > > ====================================
    > >
    > > This is the created client proxy:
    > >
    > > namespace MyNameSpace{
    > >
    > > 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="MynameServiceSoapBindi
    > > ng", Namespace="urn:myname.com")]
    > >
    > > public class MynameServiceService :
    > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > >
    > >
    > > public session sessionID;
    > >
    > >
    > > /// <remarks/>
    > >
    > > public MynameServiceService() {
    > >
    > > this.Url = "http://localhost:8080/services/MynameService";
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > >
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > >
    > > [return:

    System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > >
    > > public string
    > >

    >

    getSession([System.Xml.Serialization.XmlElementdttribute(Form=System.Xml.Sch
    > > ema.XmlSchemaForm.Unqualified)] string username,
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)] string password) {
    > >
    > > object[] results = this.Invoke("getSession", new object[] {
    > >
    > > username,
    > >
    > > password});
    > >
    > > return ((string)(results[0]));
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > public System.IAsyncResult BegingetSession(string username, string

    > password,
    > > System.AsyncCallback callback, object asyncState) {
    > >
    > > return this.BeginInvoke("getSession", new object[] {
    > >
    > > username,
    > >
    > > password}, callback, asyncState);
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > public string EndgetSession(System.IAsyncResult asyncResult) {
    > >
    > > object[] results = this.EndInvoke(asyncResult);
    > >
    > > return ((string)(results[0]));
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > >
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > >
    > > public void closeSession() {
    > >
    > > this.Invoke("closeSession", new object[0]);
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > public System.IAsyncResult BegincloseSession(System.AsyncCallback

    > callback,
    > > object asyncState) {
    > >
    > > return this.BeginInvoke("closeSession", new object[0], callback,
    > > asyncState);
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > >
    > > this.EndInvoke(asyncResult);
    > >
    > > }
    > >
    > > }
    > >
    > >
    > > /// <remarks/>
    > >
    > > [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:myname.com")]
    > >
    > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > Namespace="urn:myname.com", IsNullable=false)]
    > >
    > > public class session : System.Web.Services.Protocols.SoapHeader {
    > >
    > >
    > > /// <remarks/>
    > >
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)]
    > >
    > > public long id;
    > >
    > > }
    > >
    > > }
    > >
    > >
    > >
    > >
    > >
    > >
    > > "Dino Chiesa [Microsoft]" <> wrote in message
    > > news:%...
    > > > yes, I think you are correct. the xsi:type="xsd:long" seems to be
    > > > incorrect.
    > > >
    > > > BUT!
    > > >
    > > > We are changing the WSDL here without modifying the server. The WSDL
    > > > documents how we would like the service to appear, but if we design

    the
    > > WSDL
    > > > independently of the implementation of the service (in AXIS) , then

    > there
    > > is
    > > > no way of knowing if the two independent things coincide.
    > > >
    > > >
    > > > It appears that AXIS is using doc/literal for the SOAP body and
    > > > soap-section-5 encoded for the SOAP header. Can you check this in

    the
    > > > server/service implementation?
    > > >
    > > > --------------------
    > > >
    > > > It seems like you may be using the AXIS SimpleSessionHandler ? If

    so,
    > > > there are others who have tried to get this to work and had troubles,

    > for
    > > > example see the axis user mailing list archive, eg
    > > > http://marc.theaimsgroup.com/?l=axis-user&m=107694009529949&w=2
    > > >
    > > > or
    > > > http://marc.theaimsgroup.com/?l=axis-user&m=104204463001241&w=2
    > > >
    > > > or to search the archive:
    > > > http://marc.theaimsgroup.com/?l=axis-user&w=2&r=1&s=sessionhandler&q=b
    > > >
    > > >
    > > > The problem is that AXIS's WSDL2Java tool does not handle soapheaders

    as
    > > > defined in WSDL. If you have a WSDL (such as you have constructed

    here)
    > > > that specifies a soapheader to be used in the input message, the

    output
    > > > message, or both, then the Java implementation generated from AXIS'
    > > > "wsdl2java --server-side" does not have any support for that header.

    As
    > a
    > > > developer using AXIS, you need to provide a handler to extract the

    > > header,
    > > > or insert the header, as appropriate.
    > > >
    > > > The "SimpleSessionHandler" code included with AXIS v1.1 shows this.

    As
    > > you
    > > > can see, there is some DOM walking you have to do to extract the

    header
    > > and
    > > > de-marshal it and validate it and so on. I suppose there is similar

    > work
    > > > you have to do to "add" the header to the response.
    > > >
    > > > But even with all this I am not sure why the header would be section-5
    > > > encoded when the body is not. In the WSDL model, the soap body can

    in
    > > > fact be a different "use" than the header. In other words the literal

    or
    > > > section-5 encoded is specified on the body independently from the

    > header.
    > > > Eg,
    > > >
    > > > <wsdl:eek:utput name="getSessionResponse">
    > > > <wsdlsoap:header message="impl:soapHeader"

    part="sessionID"
    > > > use="literal"/>
    > > > <wsdlsoap:body namespace="urn:myname.com" use="literal" />
    > > > </wsdl:eek:utput>
    > > >
    > > >
    > > >
    > > > -Dino
    > > >
    > > >
    > > >
    > > > "Zihong Lu" <> wrote in message
    > > > news:...
    > > > > Dino,
    > > > >
    > > > > I have changed the session declaration in WSDL to what you

    suggested,
    > > as
    > > > > showing here:
    > > > >
    > > > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > > > <element name="sessionID" type="sens:session"/>
    > > > > <complexType name="session">
    > > > > <sequence>
    > > > > <element minOccurs="1" maxOccurs="1" name="id"
    > > > type="xsd:long"/>
    > > > > </sequence>
    > > > > </complexType>
    > > > > </schema>
    > > > >
    > > > > where namespace "sens" was defined in the <wsdl:definitions> as
    > > > > xmlns:sens="http://xml.apache.org/axis/session".
    > > > >
    > > > > Yes, the generated proxy code now has the same session class derived

    > > from
    > > > > SoapHeader, as earlier. However, compared to the code generated

    from
    > > > > simpleType declaration in WSDL earlier , the class memeber "id" now

    > has
    > > a
    > > > > data type of long, instead of the earlier string[], and it has a

    > > sensible
    > > > > name "id" that I set, instead of the earlier generated name of

    "Text"
    > > > (these
    > > > > are the only changes in the whole generated client proxy file):
    > > > >
    > > > > /// <remarks/>
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > > axis/session")]
    > > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > > >
    > > > > /// <remarks/>
    > > > >
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > > maForm.Unqualified)]
    > > > > public long id;
    > > > > }
    > > > >
    > > > > I have noticed that the "id" is unqulified, while in the example you
    > > > showed
    > > > > the "s" does not have the "Unqualified" attribute.
    > > > >
    > > > > However, even with this change, I still got the same error of
    > > > > InvalidOperationException. Since the wsdl file is manually edited,

    I
    > > did
    > > > > not change Axis server side. For the session handling, I simply use
    > > > > SimpleSessionHandler handler, a convenient handler that Axis

    provided.
    > > > >
    > > > > I have also tested the code with the "Form = ... Unqualified"

    > manually
    > > > > removed from the generated proxy code, I still got the same error.

    > The
    > > > eror
    > > > > message is copied here again for completeness:
    > > > > =======================================
    > > > > Unhandled Exception: System.InvalidOperationException: There is an

    > error
    > > > in
    > > > > XML
    > > > > document (4, 4). ---> System.InvalidOperationException: The

    specified
    > > type
    > > > > was n
    > > > > ot recognized: name='long',

    > > namespace='http://www.w3.org/2001/XMLSchema',
    > > > at
    > > > > <se
    > > > > ssionID xmlns='http://xml.apache.org/axis/session'>.
    > > > > at
    > > > >

    > >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > > > > 1_session(Boolean isNullable, Boolean checkType)
    > > > > at
    > > > >

    > >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
    > > > > 8_OutHeaders()
    > > > > =======================================
    > > > >
    > > > > The returned SOAP message is
    > > > > <?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:Header>
    > > > > <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long"
    > > > >
    > > >

    > >

    >

    xmlns:ns1="http://xml.apache.org/axis/session">-5227012230670020468</ns1:ses
    > > > > sionID>
    > > > > </soapenv:Header>
    > > > > ...
    > > > >
    > > > > the position (4,4) indicated in the error message is the

    ns1:sessionID
    > > > tag.
    > > > > Does this message looks right to you, compared to what WSDL

    declared?
    > > > > Somehow I felt the xsi:type="xsd:long" is not right, since dot/lit

    > style
    > > > > don't usually have this.
    > > > >
    > > > > -Zihong
    > > > >
    > > > >
    > > > >
    > > > > "Dino Chiesa [Microsoft]" <> wrote in

    > message
    > > > > news:%...
    > > > > > If I modify your WSDL to type the session ID this way:
    > > > > >
    > > > > > <element name="sessionID" type="sess:session"/>
    > > > > >
    > > > > > <complexType name="session">
    > > > > > <sequence>
    > > > > > <element minOccurs="1" maxOccurs="1" name="s"
    > > > > type="xsd:long"/>
    > > > > > </sequence>
    > > > > > </complexType>
    > > > > >
    > > > > >
    > > > > > it works, and generates a header class like so:
    > > > > >
    > > > > > public class session : System.Web.Services.Protocols.SoapHeader {
    > > > > > /// <remarks/>
    > > > > > [System.Xml.Serialization.XmlElementAttribute()]
    > > > > > public long s;
    > > > > > }
    > > > > >
    > > > > >
    > > > > > I think the problem is, in .NET the soapheader must derive from
    > > > > > System.Web.Services.Protocols.SoapHeader . In other words it is a
    > > > > > complexType. In your WSDL you have it as a simpleType.

    Generating
    > a
    > > > > client
    > > > > > proxy from that WSDL results in some confusion. Feels like a bug

    in
    > > the
    > > > > > wsdl.exe compiler.
    > > > > >
    > > > > > The simple fix is to change the definition of the header type in

    XSD
    > > to
    > > > > the
    > > > > > above. This generates what you would expect, I think.
    > > > > >
    > > > > > But you have to ensure this synchronizes with the AXIS server. If

    > you
    > > > are
    > > > > > generating the server from the WSDL then it should be no problem .
    > > > > >
    > > > > > -Dino
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > > "Zihong Lu" <> wrote in message
    > > > > > news:%...
    > > > > > > Dino,
    > > > > > >
    > > > > > > Thanks. That works.
    > > > > > >
    > > > > > > Now I have a second issue: the soap header. As you can see from

    > my
    > > > > > eariler
    > > > > > > wsdl file, if I do the following:
    > > > > > > (1) changed the line to <element name="getSessionReturn"
    > > > > > type="xsd:string"
    > > > > > > form="qualified"/>, to solve the null result problem;
    > > > > > > (2) uncommented out the line to indicate the soap header in the

    > > return
    > > > > > > message:
    > > > > > > <wsdlsoap:header message="impl:soapHeader" part="sessionID"
    > > > > use="literal"
    > > > > > > />
    > > > > > >
    > > > > > > When invoke the getSession() call, the .net client complained:
    > > > > > >
    > > > > > > =========================================
    > > > > > > System.InvalidOperationException: The specified type was not
    > > > recognized:
    > > > > > > name='long',
    > > > > > > namespace='http://www.w3.org/2001/XMLSchema', at <sessionID
    > > > > > > xmlns='http://xml.apache.org/axis/session'>.
    > > > > > >
    > > > > > > at
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
    > > > > > > session(Boolean isNullable, Boolean checkType)
    > > > > > > at
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read8_
    > > > > > > OutHeaders()
    > > > > > >
    > > > > > > Do I need to create serializer/deserializer for the SOAP header?

    > I
    > > > > > thought
    > > > > > > the created proxy code already recognize it and can serialize it
    > > > > > > automatically, like gSoap does.
    > > > > > >
    > > > > > > Here is the new generated client proxy:
    > > > > > > ============================
    > > > > > > namespace MyNameSpace{
    > > > > > > 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="MynameServiceSoapBindi
    > > > > > > ng", Namespace="urn:myname.com")]
    > > > > > > public class MynameServiceService :
    > > > > > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > > > > > >
    > > > > > > public session sessionID;
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > > public MynameServiceService() {
    > > > > > > this.Url =

    > > "http://localhost:8080/services/MynameService";
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > >
    > > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > > > >

    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > > > >

    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > > > > RequestNamespace="urn:myname.com",

    > > ResponseNamespace="urn:myname.com",
    > > > > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > > > > >
    > > > >

    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > > > > [return:
    > > > > > >

    System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > > > > > > public string
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > > > > > ema.XmlSchemaForm.Unqualified)] string username,
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > > > > > maForm.Unqualified)] string password) {
    > > > > > > object[] results = this.Invoke("getSession", new

    > > object[]
    > > > {
    > > > > > > username,
    > > > > > > password});
    > > > > > > return ((string)(results[0]));
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > > public System.IAsyncResult BegingetSession(string

    > username,
    > > > > string
    > > > > > > password, System.AsyncCallback callback, object asyncState) {
    > > > > > > return this.BeginInvoke("getSession", new object[] {
    > > > > > > username,
    > > > > > > password}, callback, asyncState);
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > > public string EndgetSession(System.IAsyncResult

    > asyncResult)
    > > {
    > > > > > > object[] results = this.EndInvoke(asyncResult);
    > > > > > > return ((string)(results[0]));
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > >
    > > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > > > > >

    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > > > > >

    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > > > > > RequestNamespace="urn:myname.com",

    > > ResponseNamespace="urn:myname.com",
    > > > > > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > > > > > >
    > > > >

    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > > > > > public void closeSession() {
    > > > > > > this.Invoke("closeSession", new object[0]);
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > > public System.IAsyncResult
    > > > > BegincloseSession(System.AsyncCallback
    > > > > > > callback, object asyncState) {
    > > > > > > return this.BeginInvoke("closeSession", new

    object[0],
    > > > > > callback,
    > > > > > > asyncState);
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > > public void EndcloseSession(System.IAsyncResult

    > asyncResult)
    > > {
    > > > > > > this.EndInvoke(asyncResult);
    > > > > > > }
    > > > > > > }
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > >
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > > > > > axis/session")]
    > > > > > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > > > > > Namespace="http://xml.apache.org/axis/session",

    IsNullable=false)]
    > > > > > > public class session :

    > System.Web.Services.Protocols.SoapHeader
    > > {
    > > > > > >
    > > > > > > /// <remarks/>
    > > > > > > [System.Xml.Serialization.XmlTextAttribute()]
    > > > > > > public string[] Text;
    > > > > > > }
    > > > > > > }
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Dino Chiesa [Microsoft], Jun 22, 2004
    #11
  12. Zihong Lu

    Zihong Lu Guest

    I see, you have the elementFormDefault="qualified" in the schema tag. I did
    your way, with almost identical <schema> tag for the session ID:

    <schema targetNamespace="http://xml.apache.org/axis/session"
    xmlns="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <complexType name="session">
    <sequence>
    <element minOccurs="1" maxOccurs="1" name="id" type="xsd:long"/>
    </sequence>
    </complexType>
    <element name="sessionID" type="sens:session"/>
    </schema>

    Now, the getSession() function returns nicely!!! However, the subsequent
    call closeSession() does not have the sessionID in the SOAP header, just
    like the case where I changed the sessionID namespace to urn:myname.com.
    The SOAP message is the same too (see earlier message for detail).

    Also, with the simpleType decalration:

    <schema targetNamespace="http://xml.apache.org/axis/session"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <simpleType name="session">
    <restriction base="xsd:long"/>
    </simpleType>
    <element name="sessionID" type="sens:session"/>
    </schema>

    I could use gSoap client talking to the axis server. With the complexType
    declaration as we have here, the gSoap client doesn't work any more. I
    don't need gSoap client for now, however, it does show that different
    platform clients interpret it differently, and gSoap interprets it similar
    to Axis.



    Note: if no elementFormDefault="qualified", the attribute for " public long
    id;" in the session class will be like this:
    ========================
    /// <remarks/>

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)]
    public long id;
    ========================

    It does not help either. The generated proxy with the
    elementFormDefault="qualified", looks like this now:
    ===========================
    namespace MyNameSpace{
    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="MynameServiceSoapBindi
    ng", Namespace="urn:myname.com")]
    public class MynameServiceService :
    System.Web.Services.Protocols.SoapHttpClientProtocol {

    public session sessionID;

    /// <remarks/>
    public MynameServiceService() {
    this.Url = "http://localhost:8080/services/MynameService";
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return:
    System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    public string
    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    ema.XmlSchemaForm.Unqualified)] string username,
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    maForm.Unqualified)] string password) {
    object[] results = this.Invoke("getSession", new object[] {
    username,
    password});
    return ((string)(results[0]));
    }

    /// <remarks/>
    public System.IAsyncResult BegingetSession(string username, string
    password, System.AsyncCallback callback, object asyncState) {
    return this.BeginInvoke("getSession", new object[] {
    username,
    password}, callback, asyncState);
    }

    /// <remarks/>
    public string EndgetSession(System.IAsyncResult asyncResult) {
    object[] results = this.EndInvoke(asyncResult);
    return ((string)(results[0]));
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public void closeSession() {
    this.Invoke("closeSession", new object[0]);
    }

    /// <remarks/>
    public System.IAsyncResult BegincloseSession(System.AsyncCallback
    callback, object asyncState) {
    return this.BeginInvoke("closeSession", new object[0], callback,
    asyncState);
    }

    /// <remarks/>
    public void EndcloseSession(System.IAsyncResult asyncResult) {
    this.EndInvoke(asyncResult);
    }
    }

    /// <remarks/>

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    axis/session")]
    [System.Xml.Serialization.XmlRootAttribute("sessionID",
    Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    public class session : System.Web.Services.Protocols.SoapHeader {

    /// <remarks/>
    public long id;
    }
    }
    =====================================
    Zihong Lu, Jun 22, 2004
    #12
  13. I don;t know what the problem is with closeSession(). I don't think I
    understand where are, at this point.

    You can use a simpleType in the soap header with .NET; but you don't get the
    automatic serialization and de-serialization. (as with AXIS, and I presume,
    gSOAP).

    -D


    "Zihong Lu" <> wrote in message
    news:...
    > I see, you have the elementFormDefault="qualified" in the schema tag. I

    did
    > your way, with almost identical <schema> tag for the session ID:
    >
    > <schema targetNamespace="http://xml.apache.org/axis/session"
    > xmlns="http://www.w3.org/2001/XMLSchema"
    > elementFormDefault="qualified">
    > <complexType name="session">
    > <sequence>
    > <element minOccurs="1" maxOccurs="1" name="id"

    type="xsd:long"/>
    > </sequence>
    > </complexType>
    > <element name="sessionID" type="sens:session"/>
    > </schema>
    >
    > Now, the getSession() function returns nicely!!! However, the subsequent
    > call closeSession() does not have the sessionID in the SOAP header, just
    > like the case where I changed the sessionID namespace to urn:myname.com.
    > The SOAP message is the same too (see earlier message for detail).
    >
    > Also, with the simpleType decalration:
    >
    > <schema targetNamespace="http://xml.apache.org/axis/session"
    > xmlns="http://www.w3.org/2001/XMLSchema">
    > <simpleType name="session">
    > <restriction base="xsd:long"/>
    > </simpleType>
    > <element name="sessionID" type="sens:session"/>
    > </schema>
    >
    > I could use gSoap client talking to the axis server. With the complexType
    > declaration as we have here, the gSoap client doesn't work any more. I
    > don't need gSoap client for now, however, it does show that different
    > platform clients interpret it differently, and gSoap interprets it similar
    > to Axis.
    >
    >
    >
    > Note: if no elementFormDefault="qualified", the attribute for " public

    long
    > id;" in the session class will be like this:
    > ========================
    > /// <remarks/>
    >
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)]
    > public long id;
    > ========================
    >
    > It does not help either. The generated proxy with the
    > elementFormDefault="qualified", looks like this now:
    > ===========================
    > namespace MyNameSpace{
    > 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="MynameServiceSoapBindi
    > ng", Namespace="urn:myname.com")]
    > public class MynameServiceService :
    > System.Web.Services.Protocols.SoapHttpClientProtocol {
    >
    > public session sessionID;
    >
    > /// <remarks/>
    > public MynameServiceService() {
    > this.Url = "http://localhost:8080/services/MynameService";
    > }
    >
    > /// <remarks/>
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > [return:
    > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > public string
    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > ema.XmlSchemaForm.Unqualified)] string username,
    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > maForm.Unqualified)] string password) {
    > object[] results = this.Invoke("getSession", new object[] {
    > username,
    > password});
    > return ((string)(results[0]));
    > }
    >
    > /// <remarks/>
    > public System.IAsyncResult BegingetSession(string username, string
    > password, System.AsyncCallback callback, object asyncState) {
    > return this.BeginInvoke("getSession", new object[] {
    > username,
    > password}, callback, asyncState);
    > }
    >
    > /// <remarks/>
    > public string EndgetSession(System.IAsyncResult asyncResult) {
    > object[] results = this.EndInvoke(asyncResult);
    > return ((string)(results[0]));
    > }
    >
    > /// <remarks/>
    > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > public void closeSession() {
    > this.Invoke("closeSession", new object[0]);
    > }
    >
    > /// <remarks/>
    > public System.IAsyncResult BegincloseSession(System.AsyncCallback
    > callback, object asyncState) {
    > return this.BeginInvoke("closeSession", new object[0],

    callback,
    > asyncState);
    > }
    >
    > /// <remarks/>
    > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > this.EndInvoke(asyncResult);
    > }
    > }
    >
    > /// <remarks/>
    >
    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > axis/session")]
    > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > public class session : System.Web.Services.Protocols.SoapHeader {
    >
    > /// <remarks/>
    > public long id;
    > }
    > }
    > =====================================
    >
    >
    Dino Chiesa [Microsoft], Jun 23, 2004
    #13
  14. Zihong Lu

    Zihong Lu Guest

    My .net client code looks like this:

    long sessionId = service.getSession("admin", "");
    service.closeSession();

    the closeSession() is defined in the wsdl that I showed earlier, or you can
    see from the generated cs code.

    For the complexType header, my problem with closeSession() is that after
    getSession(), I was hoping that the sessionID in the return SOAP header will
    automatically be put in the closeSession() request header, like this:

    <SOAP-ENV:Header>
    <sessionID
    xmlns="http://xml.apache.org/axis/session">5419796753085587324</sessionID>
    </SOAP-ENV:Header>

    but it did not. Actually, the closeSession() call did not include SOAP
    header in the request message at all. I think axis sends the rpc style
    headers, and the .net does wrapped style, they didn't really communicate
    although I did get the getSession() returned nicely. I will have to change
    the axis session handler SimpleSessionHandler, or customize .net header
    serialization/deserialization.

    As for the simpleType, yes, I realized that by now. For Axis, the
    SimpleSessionHandler takes care of the serialization/deserialization of the
    header. For gSoap, it automatically recognizes the header from the wsdl, I
    just need to enter the namesapce correctly, ie, use the
    "http://xml.apache.org/axis/session" namespace, then, everything works
    without coding. I guess I will have to write serialization/deserialization
    for .net for my project, so that it will have the max interop capability.

    Thanks for your help. It really helps a lot.

    -Zihong


    "Dino Chiesa [Microsoft]" <> wrote in message
    news:Ow$...
    > I don;t know what the problem is with closeSession(). I don't think I
    > understand where are, at this point.
    >
    > You can use a simpleType in the soap header with .NET; but you don't get

    the
    > automatic serialization and de-serialization. (as with AXIS, and I

    presume,
    > gSOAP).
    >
    > -D
    >
    >
    > "Zihong Lu" <> wrote in message
    > news:...
    > > I see, you have the elementFormDefault="qualified" in the schema tag. I

    > did
    > > your way, with almost identical <schema> tag for the session ID:
    > >
    > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > xmlns="http://www.w3.org/2001/XMLSchema"
    > > elementFormDefault="qualified">
    > > <complexType name="session">
    > > <sequence>
    > > <element minOccurs="1" maxOccurs="1" name="id"

    > type="xsd:long"/>
    > > </sequence>
    > > </complexType>
    > > <element name="sessionID" type="sens:session"/>
    > > </schema>
    > >
    > > Now, the getSession() function returns nicely!!! However, the

    subsequent
    > > call closeSession() does not have the sessionID in the SOAP header, just
    > > like the case where I changed the sessionID namespace to urn:myname.com.
    > > The SOAP message is the same too (see earlier message for detail).
    > >
    > > Also, with the simpleType decalration:
    > >
    > > <schema targetNamespace="http://xml.apache.org/axis/session"
    > > xmlns="http://www.w3.org/2001/XMLSchema">
    > > <simpleType name="session">
    > > <restriction base="xsd:long"/>
    > > </simpleType>
    > > <element name="sessionID" type="sens:session"/>
    > > </schema>
    > >
    > > I could use gSoap client talking to the axis server. With the

    complexType
    > > declaration as we have here, the gSoap client doesn't work any more. I
    > > don't need gSoap client for now, however, it does show that different
    > > platform clients interpret it differently, and gSoap interprets it

    similar
    > > to Axis.
    > >
    > >
    > >
    > > Note: if no elementFormDefault="qualified", the attribute for " public

    > long
    > > id;" in the session class will be like this:
    > > ========================
    > > /// <remarks/>
    > >
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)]
    > > public long id;
    > > ========================
    > >
    > > It does not help either. The generated proxy with the
    > > elementFormDefault="qualified", looks like this now:
    > > ===========================
    > > namespace MyNameSpace{
    > > 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="MynameServiceSoapBindi
    > > ng", Namespace="urn:myname.com")]
    > > public class MynameServiceService :
    > > System.Web.Services.Protocols.SoapHttpClientProtocol {
    > >
    > > public session sessionID;
    > >
    > > /// <remarks/>
    > > public MynameServiceService() {
    > > this.Url = "http://localhost:8080/services/MynameService";
    > > }
    > >
    > > /// <remarks/>
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > [return:
    > > System.Xml.Serialization.XmlElementAttribute("getSessionReturn")]
    > > public string
    > >

    >

    getSession([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Sch
    > > ema.XmlSchemaForm.Unqualified)] string username,
    > >

    >

    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
    > > maForm.Unqualified)] string password) {
    > > object[] results = this.Invoke("getSession", new object[] {
    > > username,
    > > password});
    > > return ((string)(results[0]));
    > > }
    > >
    > > /// <remarks/>
    > > public System.IAsyncResult BegingetSession(string username,

    string
    > > password, System.AsyncCallback callback, object asyncState) {
    > > return this.BeginInvoke("getSession", new object[] {
    > > username,
    > > password}, callback, asyncState);
    > > }
    > >
    > > /// <remarks/>
    > > public string EndgetSession(System.IAsyncResult asyncResult) {
    > > object[] results = this.EndInvoke(asyncResult);
    > > return ((string)(results[0]));
    > > }
    > >
    > > /// <remarks/>
    > > [System.Web.Services.Protocols.SoapHeaderAttribute("sessionID",
    > > Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
    > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
    > > RequestNamespace="urn:myname.com", ResponseNamespace="urn:myname.com",
    > > Use=System.Web.Services.Description.SoapBindingUse.Literal,
    > >

    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    > > public void closeSession() {
    > > this.Invoke("closeSession", new object[0]);
    > > }
    > >
    > > /// <remarks/>
    > > public System.IAsyncResult

    BegincloseSession(System.AsyncCallback
    > > callback, object asyncState) {
    > > return this.BeginInvoke("closeSession", new object[0],

    > callback,
    > > asyncState);
    > > }
    > >
    > > /// <remarks/>
    > > public void EndcloseSession(System.IAsyncResult asyncResult) {
    > > this.EndInvoke(asyncResult);
    > > }
    > > }
    > >
    > > /// <remarks/>
    > >
    > >

    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.apache.org/
    > > axis/session")]
    > > [System.Xml.Serialization.XmlRootAttribute("sessionID",
    > > Namespace="http://xml.apache.org/axis/session", IsNullable=false)]
    > > public class session : System.Web.Services.Protocols.SoapHeader {
    > >
    > > /// <remarks/>
    > > public long id;
    > > }
    > > }
    > > =====================================
    > >
    > >

    >
    >
    Zihong Lu, Jun 23, 2004
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    900
  2. Geathaa
    Replies:
    2
    Views:
    684
    Geathaa
    Jul 30, 2003
  3. ectoplasm
    Replies:
    12
    Views:
    626
    Zorro
    Jul 28, 2005
  4. Jan
    Replies:
    12
    Views:
    1,881
    Mike Schilling
    Sep 1, 2008
  5. Michael Tan
    Replies:
    32
    Views:
    937
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page