Hi George,

Unfortuntely, axis does not include the SimpleSessionHandler details in the wsdl it generates, or any header details as far as I know. Similarly, if you write the wsdl yourself (see the example wsdl below, with the relevant parts highlighted in *bold*) to include the required information, axis will not include it in any of the files created on the client side, although it will be incoprporated by any .Net clients genreated from the wsdl (so if your services will be used by .Net clients it is worth doing). For axis clients, the only option is to include <documentation/> elements in a hand written wsdl to state that the SimpleSessionHandler is needed on the client side.

Cheers,

Richard.

<wsdl:definitions targetNamespace="urn:wsdl.quickquery.ws.biors.biomax.de" xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; *xmlns:sess="http://xml.apache.org/axis/session"*
   xmlns:tns="urn:wsdl.quickquery.ws.biors.biomax.de"
   xmlns:types="urn:quickquery.ws.biors.biomax.de">

<wsdl:documentation>Web Service providing the ability to query a BioRS server with a simple text query. Clients invoking the service specify a simple text query with one or more search terms linked with "AND"/"OR" (or "&amp;"/"|") operators, which will be evaluated against the BioRS server's AllText index (or indices). The result format to be returned and the list of databanks to be searched must be provided as parameters, and also optionally, a specific list of elements to be returned (only applicable to the ELEMENTS and XML_ELEMENTS result formats). Clients with their own username/password for the BioRS server may provide these parameters, or if these a provided as null a default &quot;guest&quot; username is used. A session is maintained between the client and service via SOAP Header session IDs, and each invocation of an operation of the service returns a successive entry from the set of entries matching the given query, or a message indicating that no entries matched the query. Each entry is returned with the number of the entry and the total number of entries matching the query, enabling clients to determine when all entries have been returned. In order to make use of the SOAP header session IDs, Apache Axis clients need only to include the org.apache.axis.handlers.SimpleSessionHandler in the request and response flows of the client. Clients based on proxy classes generated by Microsoft Visual Studio from this WSDL will have the code required to use the sessions in the proxy.
</wsdl:documentation>

        <wsdl:types>
        
                *<!-- SOAP Header Session ID -->  
        
                <schema targetNamespace="http://xml.apache.org/axis/session"; 
xmlns="http://www.w3.org/2001/XMLSchema";>
                        <simpleType name="sessID">
                                <restriction base="xsd:long"/>
                        </simpleType>
                        <element name="sessionID" type="sess:sessID"/>
                </schema>*
        
                <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns="urn:quickquery.ws.biors.biomax.de" 
targetNamespace="urn:quickquery.ws.biors.biomax.de">
                        
                        <!-- Input message elements -->   
                        
                        <xsd:simpleType name="formatType">
                                <wsdl:documentation>
                                        Enumeration type giving the possible 
data formats in which entries can be retrieved from the BioRS server.
                                        FASTA - FASTA format.
                                        ENTRY - Complete entries in source 
formatting.
                                        XML_ENTRY - Complete entry in BioRS 
internal XML markup.
                                        XML_ELEMENTS - Entry separated into 
BioRS elements, formatted in BioRS internal XML.
                                        ELEMENTS - Entry separated into BioRS 
elements, no additional formatting.
                                </wsdl:documentation>
                                <xsd:restriction base="xsd:string">
                                        <xsd:enumeration value="FASTA"/>
                                        <xsd:enumeration value="ENTRY"/>
                                        <xsd:enumeration value="XML_ENTRY"/>
                                        <xsd:enumeration value="XML_ELEMENTS"/>
                                        <xsd:enumeration value="ELEMENTS"/>
                                </xsd:restriction>
                        </xsd:simpleType>
                        
                        <xsd:complexType name="databanksType">
                                <wsdl:documentation>
                                        The databanksType contains a list of 
the names of the databanks against which the given query should be executed.
                                </wsdl:documentation>
                                <xsd:sequence>
                                        <xsd:element name="databankName" type="xsd:string" 
minOccurs="1" maxOccurs="999"/>
                                </xsd:sequence>
                        </xsd:complexType>
                        
                        <xsd:complexType name="requiredElementsType">
                                <wsdl:documentation>
                                        The requiredElementsType contains a 
list of the names of the elements required when ELEMENTS or XML_ELEMENTS 
formatType are specified, and only a subset of all elements are required. For 
other result formats, or when all elements are required null can be provided 
for this parameter.
                                </wsdl:documentation>
                                <xsd:sequence>
                                        <xsd:element name="elementName" type="xsd:string" 
minOccurs="1" maxOccurs="999"/>
                                </xsd:sequence>
                        </xsd:complexType>
                        
                        <!-- Return message elements -->
                        
                        <xsd:complexType name="returnedElementsType">
                                <wsdl:documentation>
                                        The returnedElementsType type 
represents a collection ofl BioRS elements returned by a query. Each instance 
of this type consists of one or more instance of elementType, each representing 
an individual element.
                                </wsdl:documentation>
                                <xsd:sequence>
                                        <xsd:element name="element" type="elementType" 
minOccurs="1" maxOccurs="999"/>
                                </xsd:sequence>
                        </xsd:complexType>
                        
                        <xsd:complexType name="elementType">
                                <wsdl:documentation>
                                        The elementType type represents an 
individual BioRS element returned by a query. Each instance of this type 
contains the name of the element and the element content.
                                </wsdl:documentation>
                                <xsd:sequence>
                                        <xsd:element name="elementName" type="xsd:string" 
minOccurs="1" maxOccurs="1"/>
                                        <xsd:element name="elementContent" type="xsd:string" 
minOccurs="1" maxOccurs="1"/>
                                </xsd:sequence>
                        </xsd:complexType>
                        
                        <xsd:element name="result">
                                <wsdl:documentation>
                                        The result type contains a single 
result returned by a BioRS query. Each results consists of the total number of 
results for the query, the numer of this result, the databank the result is 
from and either a complete result in the specified format, a collection of 
elements, if the ELEMENTS result format was specified, or a message indicating 
that no results matched the given query.
                                </wsdl:documentation>
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="resultNumber" type="xsd:int" 
minOccurs="0" maxOccurs="1"/>
                                                <xsd:element name="totalResults" type="xsd:int" 
minOccurs="1" maxOccurs="1"/>
                                                <xsd:element name="databank" type="xsd:string" 
minOccurs="0" maxOccurs="1"/>
                                                <xsd:choice>
                                                        <xsd:element name="entry" 
type="xsd:string"/>
                                                        <xsd:element name="returnedElements" 
type="returnedElementsType"/>
                                                        <xsd:element name="noMatchesMessage" 
type="xsd:string"/>
                                                </xsd:choice>
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                        
                        <!-- Methods signatures -->
                        
                        <xsd:element name="getBiorsEntry">
                                <wsdl:documentation>
                                        Required parameters:
username - username to be used to connect to the BioRS server used by the service. password - password matching the username provided. queryString - the query in BioRS query language.
                                        databanks - an instance of type 
databanksType contianing the names of the databanks against which the uery 
should be executed.
                                        returnFormat - the format in which 
results should be returned (FASTA, ENTRY, XML_ENTRY, ELEMENTS, XML_ELEMENTS).
                                        requiredElements - an instance of type 
requiredElementsType containing the names of the elements to be returned (or 
null).
                                        If you do not have a username/password, 
set these as null to login as a guest.
                                </wsdl:documentation>     
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="username" type="xsd:string" 
nillable="true" maxOccurs="1"/>
                                                <xsd:element name="password" type="xsd:string" 
nillable="true" maxOccurs="1"/>
                                                <xsd:element name="queryString" type="xsd:string" 
minOccurs="1" maxOccurs="1"/>
                                                <xsd:element name="databanks" type="databanksType" 
minOccurs="1" maxOccurs="1"/>
                                                <xsd:element name="returnFormat" type="formatType" 
minOccurs="1" maxOccurs="1"/>
                                                <xsd:element name="requiredElements" 
type="requiredElementsType" minOccurs="0" maxOccurs="1"/>
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                        
                        <xsd:element name="getBiorsEntryResponse">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element ref="result"/>
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>

                </xsd:schema>
        </wsdl:types>
        
*<message name="soapHeader"> <part name="sessID" element="sess:sessionID" /> </message> *
        
        <message name="getBiorsEntryReq">
                <part name="parameters" element="types:getBiorsEntry"/>
        </message>
        <message name="getBiorsEntryResp">
                <part name="parameters" element="types:getBiorsEntryResponse"/>
        </message>
        
        <portType name="BiorsQuickQueryPortType">
                <operation name="getBiorsEntry">
                        <input message="tns:getBiorsEntryReq"/>
                        <output message="tns:getBiorsEntryResp"/>
                </operation>
        </portType>
        
        <wsdl:binding name="BiorsQuickQuerySOAPBinding" 
type="tns:BiorsQuickQueryPortType">
                <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
                <wsdl:operation name="getBiorsEntry">
                        <soap:operation soapAction="getBiorsEntry" 
style="document"/>
                        <wsdl:input>
                                *<soap:header message="tns:soapHeader" part="sessID" 
use="literal"/>*
                                <soap:body use="literal"/>
                        </wsdl:input>
                        <wsdl:output>
                                *<soap:header message="tns:soapHeader" part="sessID" 
use="literal"/>*
                                <soap:body use="literal"/>
                        </wsdl:output>
                </wsdl:operation> 
        </wsdl:binding>
        
        <service name="BiorsQuickQueryService">
                <port name="BiorsQuickQuery" 
binding="tns:BiorsQuickQuerySOAPBinding">
                        <soap:address 
location="http://146.107.217.111:8081/biors/services/BiorsQuickQuery"/>
                </port>
        </service>
</wsdl:definitions>



Sueveges Gyoergy wrote:

Hi all,

I'm now testing how axis works. I need a session based web service, so I test the SimpleSessionHandler. On the API site it is written, that it will check if there is a header with session_id, and when there is not, then is creates a session. So I would except that in the generated wsdl (http://localhost:8085/axis/services/ZagreusService?wsdl) there is a soap header info in the bining section. So now how will the WSDL2Java know how to create such a client that creates soap header with sessionid when sending request? Do I imagine the things in wrong way? Or Is it not a suggested way to create wsdl from the server classes, and then to create the client from wsdl?

I deployed my test Servie on the server side with the following wsdd:


<deployment xmlns="http://xml.apache.org/axis/wsdd/";
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>

<service name="ZagreusService" provider="java:RPC">
 <requestFlow>
   <handler name="soapMonitor"
    type="java:com.etixpert.zagreus.server.axis.SOAPMonitor"/>
   <handler name="sessionHandler"
   type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
  </requestFlow>
  <responseFlow>
     <handler name="responsesessionHandler"
type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
       <handler name="responsesoapMonitor"
     type="java:com.etixpert.zagreus.server.axis.SOAPMonitor"/>
  </responseFlow>
<parameter name="className" value="com.etixpert.zagreus.server.axis.TestService"/>
  <parameter name="allowedMethods" value="*"/>
 </service>

</deployment>

I have the following TestService:

  package com.etixpert.zagreus.server.axis;

  import org.apache.axis.transport.http.*;
  import org.apache.axis.handlers.SimpleSessionHandler;
  import org.apache.axis.session.*;
  import org.apache.axis.*;
  import java.util.*;


  public class TestService {

public String test(String param) { MessageContext context = MessageContext.getCurrentContext();
        Session session = context.getSession();

        ......

    }

    public void login(String user, String password) throws AxisFault {
        ....

    }
 }

Generated wsdl. where there is no header info:

 <?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8085/axis/services/ZagreusService";
xmlns:apachesoap="http://xml.apache.org/xml-soap";
xmlns:impl="http://localhost:8085/axis/services/ZagreusService";
xmlns:intf="http://localhost:8085/axis/services/ZagreusService";
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";>
<!--WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)-->

   <wsdl:message name="loginResponse">

   </wsdl:message>

   <wsdl:message name="testResponse">

      <wsdl:part name="testReturn" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:message name="loginRequest">

      <wsdl:part name="user" type="soapenc:string"/>

      <wsdl:part name="password" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:message name="testRequest">

      <wsdl:part name="param" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:portType name="TestService">

      <wsdl:operation name="test" parameterOrder="param">

         <wsdl:input message="impl:testRequest" name="testRequest"/>

         <wsdl:output message="impl:testResponse" name="testResponse"/>

      </wsdl:operation>

      <wsdl:operation name="login" parameterOrder="user password">

         <wsdl:input message="impl:loginRequest" name="loginRequest"/>

         <wsdl:output message="impl:loginResponse" name="loginResponse"/>

      </wsdl:operation>

   </wsdl:portType>

<wsdl:binding name="ZagreusServiceSoapBinding" type="impl:TestService">

      <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="test">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="testRequest">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="http://axis.server.zagreus.etixpert.com"; use="encoded"/>

         </wsdl:input>

         <wsdl:output name="testResponse">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="http://localhost:8085/axis/services/ZagreusService"; use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="login">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="loginRequest">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="http://axis.server.zagreus.etixpert.com"; use="encoded"/>

         </wsdl:input>

         <wsdl:output name="loginResponse">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="http://localhost:8085/axis/services/ZagreusService"; use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TestServiceService">

<wsdl:port binding="impl:ZagreusServiceSoapBinding" name="ZagreusService">

         <wsdlsoap:address
location="http://localhost:8085/axis/services/ZagreusService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>


Thnx for the help
 George



Reply via email to