You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Asma Maalej <am...@laas.fr> on 2009/09/21 17:18:58 UTC

Axis 2 Client Exception

hello

I'm working on web service, I'm used to invoke them across Axis2 Client 
to which I engage module to intercept response time and it worked fine.
however, this does not work any more well. In fact, when I try to run 
the main client class, an exception launch caused by the following 
instruction :
*****************
ConfigurationContext ctx 
=ConfigurationContextFactory.createConfigurationContextFromFileSystem(urlRep,urlAxis2);
*********************
and particularly, the urlAxis2 variable is the one which causes problem, 
in fact it's the the path of Axis2.xml file as shown below

String 
urlAxis2="E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test.cltClient/WEB-INF/conf";
String urlRep 
="E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test.cltClient/WEB-INF";

knowing that the module .mar that I want to engage is already under the 
modules repository and the concerned handlers are configured in 
axis2.xml file
 
the exception code is as follow:
*****
org.apache.axis2.AxisFault: System can not find the given axis2.xml 
E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test.cltClient/WEB-INF/conf
    at 
org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:118)
    at 
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
    at 
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
    at exemple.TestClient.main(TestClient.java:16)
*****

I'm waiting for your help

-- 
Asma MÂALEJ BESBES
Laboratoire LAAS - CNRS
Toulouse - France
Tèl: +33 (0)5 61 33 62 63
Mobile: +33 (0)6 72 18 36 56
E-mail: amaalej@laas.fr


Re: Customizing end point location

Posted by Manuel Darveau <ma...@gmail.com>.
I finally found a hack to fix https support. Note that in my case, I use
axis2 with an embedde jetty. This complicates the solution a bit. If you
want axis to start its own http server skip the first part.

First part: https support in axis2 embedded in jetty server:
What I did:
In the "<!-- Transport Ins -->" section of the axis2.xml, I added this:
    <transportReceiver name="https" class="com.xxx.HTTPSCustomListener">
        <parameter name="port">8444</parameter>
    </transportReceiver>

Where HTTPSCustomListener is a custom class that extends axis's
CustomListener:

package com.xxx;
import org.apache.axis2.transport.http.CustomListener;
/**
 * We use this custom listener so the https schema is returned in the
endpoint definition and wsdl if generated
 * correctly with https schema.
 */
public class HTTPSCustomListener extends CustomListener {
    public HTTPSCustomListener() {
        super( 443, "https" );
    }
}

And in the  <!-- Transport Outs --> section, I added:

    <transportSender name="https"

class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding">chunked</parameter>
    </transportSender>

In my case, we dont use the default https port so it is overriden in the
transportReceiver config to 8443. If you want the default port 443, you can
remove the "<parameter name="port">8444</parameter>".

Also, I did not want to have any http endpoint. I extended the default
AxisServlet to skip the part where it adds the http server:
    @Override
    public synchronized void init( ServletConfig config ) throws
ServletException {
        /*
         * Start of copy from AxisServlet.init(ServletConfig).
         * Review this if we upgrade to axis 1.6
         */
        try {
            this.servletConfig = config;
            ServletContext servletContext =
servletConfig.getServletContext();
            this.configContext = (ConfigurationContext)
servletContext.getAttribute( CONFIGURATION_CONTEXT );
            if ( configContext == null ) {
                configContext = initConfigContext( config );
                config.getServletContext().setAttribute(
CONFIGURATION_CONTEXT, configContext );
            }
            axisConfiguration = configContext.getAxisConfiguration();

            ListenerManager listenerManager = new ListenerManager();
            listenerManager.init( configContext );

            /*
             * Start of hack to remove http endpoints from wsdl
             */
            // Add HTTP
//            TransportInDescription httpTransportInDescription = new
TransportInDescription( Constants.TRANSPORT_HTTP );
//            httpTransportInDescription.setReceiver( this );
//            listenerManager.addListener( httpTransportInDescription, true
);
            /*
             * End of hack to remove http endpoints from wsdl
             */

            listenerManager.start();
            ListenerManager.defaultConfigurationContext = configContext;
            agent = new ListingAgent( configContext );

            initParams();

        } catch ( Exception e ) {
            throw new ServletException( e );
        }

>From your axis2.xml file, you can comment the http transport receiver.
However, you need keep the http transportSender. This sucks but it is needed
since CommonsHTTPTransportSender (used by the https transportSender) does a
msgContext.getConfigurationContext().getAxisConfiguration().getTransportOut(Constants.TRANSPORT_HTTP)
with Constants.TRANSPORT_HTTP hardcoded...

End of part one

Part two: Let axis start the https server and keep http end points:
In the <!-- Transport Ins --> section:
    <transportReceiver name="https" class="transport.http.SimpleHTTPServer">
        <parameter name="hostname">
https://your_server_hostname:443/your_servlet_context</parameter>
    </transportReceiver>

This will start an https server (just a connector actually). You can add
"<parameter name="port">8444</parameter>" to set a custom internal port. If
you do, set the custom port in the hostname *as it is seen from the client*.
Server and client port could be different if your firewall does some port
forwarding.

Hope it help!

Manuel


On Fri, Nov 20, 2009 at 12:25 PM, Sanjay Gupta <Sanjay.Gupta@billwiseinc.com
> wrote:

>  No I didn't find any solution. I did see the JIRA as well. It was broken
> in 1.4.1 as well.
>
> Sanjay
>
>
>
> *From:* Manuel Darveau [mailto:manueldarveau@gmail.com]
> *Sent:* Friday, November 20, 2009 9:01 AM
>
> *To:* axis-user@ws.apache.org
> *Subject:* Re: Customizing end point location
>
>
>
> Did you found a solution? I am not able to deploy a webservice over an
> ssl/https connection for this reason.
>
> A message on this list from Andread Veithen (Nov 5) seems to indicate that
> this is broken in 1.5 but will be fixed in 1.6. He refers to AXIS2-4465.
>
> Manuel
>
> On Wed, Sep 23, 2009 at 11:49 PM, Sanjay Gupta <
> Sanjay.Gupta@billwiseinc.com> wrote:
>
> Hi,
> Deos any have any suggesion on how I can accomplish this. I would
> appreciate any help.
> Thanks
> Sanjay
>
>
> -----Original Message-----
> From: Sanjay Gupta [mailto:Sanjay.Gupta@billwiseinc.com]
> Sent: Monday, September 21, 2009 3:40 PM
> To: axis-user@ws.apache.org
>
> Subject: Customizing end point location
>
> Hi,
> I have pojo based servcies deployed in axis2 inside tomcat. The endpoint
> url inside autogenerated wsdl has http in "<soap12:address location" even
> though I am using ssl on port 8443. Is there a way to change the http  to
> https. I am able to get proper port in the url by using hostname parameter
> in transportReceiver tag but not https. The service itself is working fine
> using https on port 8443.
> Sanjay
>
>
>

RE: Customizing end point location

Posted by Sanjay Gupta <Sa...@billwiseinc.com>.
No I didn't find any solution. I did see the JIRA as well. It was broken in 1.4.1 as well.
Sanjay

From: Manuel Darveau [mailto:manueldarveau@gmail.com]
Sent: Friday, November 20, 2009 9:01 AM
To: axis-user@ws.apache.org
Subject: Re: Customizing end point location

Did you found a solution? I am not able to deploy a webservice over an ssl/https connection for this reason.

A message on this list from Andread Veithen (Nov 5) seems to indicate that this is broken in 1.5 but will be fixed in 1.6. He refers to AXIS2-4465.

Manuel
On Wed, Sep 23, 2009 at 11:49 PM, Sanjay Gupta <Sa...@billwiseinc.com>> wrote:
Hi,
Deos any have any suggesion on how I can accomplish this. I would appreciate any help.
Thanks
Sanjay

-----Original Message-----
From: Sanjay Gupta [mailto:Sanjay.Gupta@billwiseinc.com<ma...@billwiseinc.com>]
Sent: Monday, September 21, 2009 3:40 PM
To: axis-user@ws.apache.org<ma...@ws.apache.org>
Subject: Customizing end point location

Hi,
I have pojo based servcies deployed in axis2 inside tomcat. The endpoint url inside autogenerated wsdl has http in "<soap12:address location" even though I am using ssl on port 8443. Is there a way to change the http  to https. I am able to get proper port in the url by using hostname parameter in transportReceiver tag but not https. The service itself is working fine using https on port 8443.
Sanjay


Re: Customizing end point location

Posted by Manuel Darveau <ma...@gmail.com>.
Did you found a solution? I am not able to deploy a webservice over an
ssl/https connection for this reason.

A message on this list from Andread Veithen (Nov 5) seems to indicate that
this is broken in 1.5 but will be fixed in 1.6. He refers to AXIS2-4465.

Manuel

On Wed, Sep 23, 2009 at 11:49 PM, Sanjay Gupta <Sanjay.Gupta@billwiseinc.com
> wrote:

> Hi,
> Deos any have any suggesion on how I can accomplish this. I would
> appreciate any help.
> Thanks
> Sanjay
>
> -----Original Message-----
> From: Sanjay Gupta [mailto:Sanjay.Gupta@billwiseinc.com]
> Sent: Monday, September 21, 2009 3:40 PM
> To: axis-user@ws.apache.org
> Subject: Customizing end point location
>
> Hi,
> I have pojo based servcies deployed in axis2 inside tomcat. The endpoint
> url inside autogenerated wsdl has http in "<soap12:address location" even
> though I am using ssl on port 8443. Is there a way to change the http  to
> https. I am able to get proper port in the url by using hostname parameter
> in transportReceiver tag but not https. The service itself is working fine
> using https on port 8443.
> Sanjay
>

RE: Customizing end point location

Posted by Sanjay Gupta <Sa...@billwiseinc.com>.
Hi,
Deos any have any suggesion on how I can accomplish this. I would appreciate any help.
Thanks
Sanjay

-----Original Message-----
From: Sanjay Gupta [mailto:Sanjay.Gupta@billwiseinc.com] 
Sent: Monday, September 21, 2009 3:40 PM
To: axis-user@ws.apache.org
Subject: Customizing end point location

Hi,
I have pojo based servcies deployed in axis2 inside tomcat. The endpoint url inside autogenerated wsdl has http in "<soap12:address location" even though I am using ssl on port 8443. Is there a way to change the http  to https. I am able to get proper port in the url by using hostname parameter in transportReceiver tag but not https. The service itself is working fine using https on port 8443. 
Sanjay

Customizing end point location

Posted by Sanjay Gupta <Sa...@billwiseinc.com>.
Hi,
I have pojo based servcies deployed in axis2 inside tomcat. The endpoint url inside autogenerated wsdl has http in "<soap12:address location" even though I am using ssl on port 8443. Is there a way to change the http  to https. I am able to get proper port in the url by using hostname parameter in transportReceiver tag but not https. The service itself is working fine using https on port 8443. 
Sanjay

RE: Axis 2 Client Exception

Posted by Yashwanth <yr...@cisco.com>.
You should actually point to the axis2.xml (not just config folder) 

Set
urlAxis2="E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/w
tpwebapps/test.cltClient/WEB-INF/conf/axis2.xml";

-Yash

-----Original Message-----
From: Asma Maalej [mailto:amaalej@laas.fr] 
Sent: Monday, September 21, 2009 8:19 AM
To: axis-user@ws.apache.org
Subject: Axis 2 Client Exception

hello

I'm working on web service, I'm used to invoke them across Axis2 Client to
which I engage module to intercept response time and it worked fine.
however, this does not work any more well. In fact, when I try to run the
main client class, an exception launch caused by the following instruction :
*****************
ConfigurationContext ctx
=ConfigurationContextFactory.createConfigurationContextFromFileSystem(urlRep
,urlAxis2);
*********************
and particularly, the urlAxis2 variable is the one which causes problem, in
fact it's the the path of Axis2.xml file as shown below

String
urlAxis2="E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/w
tpwebapps/test.cltClient/WEB-INF/conf";
String urlRep
="E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapp
s/test.cltClient/WEB-INF";

knowing that the module .mar that I want to engage is already under the
modules repository and the concerned handlers are configured in axis2.xml
file
 
the exception code is as follow:
*****
org.apache.axis2.AxisFault: System can not find the given axis2.xml
E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/
test.cltClient/WEB-INF/conf
    at
org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(File
SystemConfigurator.java:118)
    at
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCont
ext(ConfigurationContextFactory.java:68)
    at
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCont
extFromFileSystem(ConfigurationContextFactory.java:184)
    at exemple.TestClient.main(TestClient.java:16)
*****

I'm waiting for your help

--
Asma MÂALEJ BESBES
Laboratoire LAAS - CNRS
Toulouse - France
Tèl: +33 (0)5 61 33 62 63
Mobile: +33 (0)6 72 18 36 56
E-mail: amaalej@laas.fr