axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <tore.lar...@comptel.com>
Subject RE: [Axis2] Client configuration
Date Wed, 08 Mar 2006 09:14:43 GMT
Thanks for your answer Ajith,

I'm using wsdl2java and XmlBeans for generation of classes.

In Axis2 version 0.94 my client code was like this:

<snip>
   /* Create the client stub */
   DLExternalInformationStub stub = new DLExternalInformationStub(null,
endpointServiceURL);

   /* set client options */
   Options clientOptions = new Options();
   clientOptions.setTimeOutInMilliSeconds(connectionTimeout);
   stub._setOptions(clientOptions);

   /* Service invocation */
   QueryExternalInformationResponseDocument responseDoc =
stub.queryExternalInformation(requestDoc);
</snip>

The sent envelope was:

<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <soapenv:Header>
 
<wsa:To>http://localhost:1300/sos/v/pub/work/6D53D7AB-B64F-6334-AE06-C7C7E303
D931/siml/adt/endpoint</wsa:To>
         <wsa:ReplyTo>
 
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous<
/wsa:Address>
         </wsa:ReplyTo>
         <wsa:MessageID>72DEFE5CECE33D8D5211413057222187</wsa:MessageID>
      </soapenv:Header>
      <soapenv:Body>
         <queryExternalInformationRequest
xmlns="http://nims.incatel.com/webservice/generatedtypes/externalinformation/
requesttypes">
            <externalInfoType>Subscriber</externalInfoType>
            <key>123</key>
         </queryExternalInformationRequest>
      </soapenv:Body>
   </soapenv:Envelope>0 

In Axis2 version 0.95-SNAPSHOT from 2006-03-02 the API had some changes and I
modified my client code to this:

<snip>
   /* Create the client stub */
   DLExternalInformationStub stub = new DLExternalInformationStub(null,
endpointServiceURL);

   /* get serviceClient */
   ServiceClient serviceClient = stub._getServiceClient();
            
   /* set client options */
   Options clientOptions = new Options();
   clientOptions.setTimeOutInMilliSeconds(connectionTimeout);
   serviceClient.setOptions(clientOptions);
   stub._setServiceClient(serviceClient);

   /* Service invocation */
   QueryExternalInformationResponseDocument responseDoc =
stub.queryExternalInformation(requestDoc);
</snip>

The change was not successful and I got the following fault message:

   <message>
       Cannot infer transport information from the URL information provided
   </message>

I started to give some more configuration explicitly to the serviceClient:

<snip>
   ...
   clientOptions.setTranportOut(new TransportOutDescription(new
QName(Constants.TRANSPORT_HTTP)));
   clientOptions.setTransportIn(new TransportInDescription(new
QName(Constants.TRANSPORT_HTTP)));
   ...
</snip>

But I did not succeed in getting a soap envelope sent by Axis2-0.95-SNAPSHOT.
I only got:
<message>null</message> back to my test client. (The "message" tag is my own
response from the Axis2 client back to the Eclipse test client.)

Then I was wondering how I could use Axis2.xml to do all of this
configuration for all my clients.
My wsdl specifies a document/literal service with request and response.


The current axis2.xml is like this:

<axisconfig name="AxisJava2.0">
    <!-- ================================================= -->
    <!-- Parameters -->
    <!-- ================================================= -->
    <parameter name="hotdeployment" locked="false">true</parameter>
    <parameter name="hotupdate" locked="false">false</parameter>
    <parameter name="enableMTOM" locked="false">true</parameter>
    <!-- Uncomment this to enable REST support -->
    <!--    <parameter name="enableREST" locked="false">true</parameter>-->


    <parameter name="userName" locked="false">admin</parameter>
    <parameter name="password" locked="false">axis2</parameter>

    <parameter name="seralizeLocation" locked="false">.</parameter>
    <hostConfiguration>
        <ip>127.0.0.1</ip>
        <port>5555</port>
    </hostConfiguration>


    <!--if you want to extract the service archive file and work with that
please uncomment this-->
    <!--else , it wont extract archive file or does not take into
consideration if someone drop-->
    <!--exploded directory into /service directory-->
    <!--<parameter name="extractServiceArchive"
locked="false">true</parameter>-->


    <!--    The way of adding listener to the system-->
    <!--    <listener class="org.apache.axis2.ObserverIMPL">-->
    <!--        <parameter name="RSS_URL"
locked="false">http://127.0.0.1/rss</parameter>-->
    <!--    </listener>-->

    <!-- ================================================= -->
    <!-- Message Receivers -->
    <!-- ================================================= -->
    <!--This is the Deafult Message Receiver for the system , if you want to
have MessageReceivers for -->
    <!--all the other MEP implement it and add the correct entry to here , so
that you can refer from-->
    <!--any operation -->
    <!--Note : You can ovride this for particular service by adding the same
element with your requirement-->
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
 
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </messageReceivers>
    <!-- ================================================= -->
    <!-- Transport Ins -->
    <!-- ================================================= -->
    <transportReceiver name="http"
class="org.apache.axis2.transport.http.SimpleHTTPServer">
        <parameter name="port" locked="false">6060</parameter>
    </transportReceiver>

    <!-- Uncomment this one with the appropriate papameters to enable the
SMTP transport Receiver
    <transportReceiver name="mail"
class="org.apache.axis2.transport.mail.SimpleMailListener">
          <parameter name="transport.mail.pop3.host"
locked="false">127.0.0.1</parameter>
          <parameter name="transport.mail.pop3.user"
locked="false">axis2</parameter>
          <parameter name="transport.mail.pop3.password"
locked="false">axis2</parameter>
          <parameter name="transport.mail.pop3.port"
locked="false">110</parameter>
          <parameter name="transport.mail.replyToAddress"
locked="false">axis2@127.0.0.1</parameter>
      </transportReceiver> -->

    <!-- Uncomment this one with the appropriate papameters to enable the tcp
transport Receiver -->
    <transportReceiver name="tcp"
class="org.apache.axis2.transport.tcp.TCPServer">
        <parameter name="port" locked="false">6060</parameter>
    </transportReceiver>

    <!-- Uncomment this one with the appropriate papameters to enable the jms
transport Receiver -->
    <transportReceiver name="jms"
class="org.apache.axis2.transport.jms.SimpleJMSListener">
        <parameter name="transport.jms.Destination"
locked="false">dynamicQueues/FOO</parameter>
        <parameter name="java.naming.factory.initial" locked="false">
            org.activemq.jndi.ActiveMQInitialContextFactory</parameter>
        <parameter name="java.naming.provider.url"
locked="false">tcp://localhost:61616</parameter>
    </transportReceiver>

    <!-- ================================================= -->
    <!-- Transport Outs -->
    <!-- ================================================= -->

    <transportSender name="tcp"
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
    <transportSender name="local"
class="org.apache.axis2.transport.local.LocalTransportSender"/>
    <transportSender name="jms"
class="org.apache.axis2.transport.jms.JMSSender"/>
    <transportSender name="http"
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding"
locked="false">chunked</parameter>
    </transportSender>
    <transportSender name="https"
 
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding"
locked="false">chunked</parameter>
    </transportSender>

    <!-- Uncomment this one with the appropriate papameters to enable the
SMTP transport Receiver
   <transportSender name="mailto"
class="org.apache.axis2.transport.mail.MailTransportSender">
       <parameter name="transport.mail.smtp.host"
locked="false">127.0.0.1</parameter>
       <parameter name="transport.mail.smtp.user"
locked="false">axis2</parameter>
       <parameter name="transport.mail.smtp.password"
locked="false">axis2</parameter>
       <parameter name="transport.mail.smtp.port"
locked="false">25</parameter>
   </transportSender>
   -->

    <!-- ================================================= -->
    <!-- Global Modules  -->
    <!-- ================================================= -->
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>


    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <!--<moduleConfig name="addressing">-->
    <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
    <!--</moduleConfig>-->

    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="inflow">
        <!--  System pre defined phases       -->
        <phase name="TransportIn"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.engine.AddressingBasedDispatcher">
                <order phase="Dispatch"/>
            </handler>

            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.engine.RequestURIBasedDispatcher">
                <order phase="Dispatch"/>
            </handler>

            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
                <order phase="Dispatch"/>
            </handler>

            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
                <order phase="Dispatch"/>
            </handler>
            <handler name="InstanceDispatcher"
                     class="org.apache.axis2.engine.InstanceDispatcher">
                <order phase="PostDispatch"/>
            </handler>
        </phase>
        <!--  System pre defined phases       -->
        <!--   After Postdispatch phase module author or or service author
can add any phase he want      -->
        <phase name="ComptelPhase">
            <handler name="SoapHeaderReader"
 
class="com.incatel.nims.webservice.handlers.SoapHeaderReader">
                <order phase="ComptelPhase"/>
            </handler>
        </phase>
    </phaseOrder>
    <phaseOrder type="outflow">
        <!--      user can add his own phases to this area  -->
        <phase name="userphase1"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
    </phaseOrder>
    <phaseOrder type="INfaultflow">
        <!--      user can add his own phases to this area  -->
        <phase name="userphase1"/>
    </phaseOrder>
    <phaseOrder type="Outfaultflow">
        <!--      user can add his own phases to this area  -->
        <phase name="userphase1"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
    </phaseOrder>
</axisconfig>

I guess that it is possible to do client configuration of transports and
modules with a similar configuration file. Are there good examples on this
issue?

Also I think the new architecture of Axis is very good. I have integrated my
projects in Maven2, both client side and service side Axis2 web services. I
had some work getting the new application structure (catalog structure) and
the new file ending .aar. But it works fine now.

Many thanks to the Axis2 team!

Best regards
Tore Larsen


-----Original Message-----
From: Ajith Ranabahu [mailto:ajith.ranabahu@gmail.com] 
Sent: 7. mars 2006 14:37
To: axis-user@ws.apache.org
Subject: Re: [Axis2] Client configuration

Hi Tore,
What kind of configurations are you interested in here ? module engagement ?

On 3/7/06, tore.larsen@comptel.com <tore.larsen@comptel.com> wrote:
>
>
>
> Hei,
>
> I'm making clients based on axis2. I found that the api to the 
> generated stub and ServiceClient have changed from version 0.94 to the 
> o.95-SNAPSHOT that I downloaded and built myself.
>
> It seems that the new api is based on more programmatic configuration 
> of the client. In order to avoid that, how do I use axis2.xml or 
> equivalent to configure clients. I have 3-4 clients that could use the 
> same configuration file.
>
> Best regards
> Tore Larsen
> Senior Software Engineer
>  Comptel Communication AS
> e-mail        :  tore.larsen@comptel.com


--
Ajith Ranabahu

Mime
View raw message