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 Ingolf Krueger <sp...@me.com> on 2013/06/02 04:07:33 UTC

Programmatically changing the Axis2 http port

Hi there --

I am trying to use Axis2 in embedded mode from within Clojure, and want to programmatically change the http port at which my services are presented so as to be able to run multiple independent Axis2 servers on the same box.  I understand that this could be accomplished using axis2.xml, but I'd prefer to accomplish it via code.

I have searched the archives and documents, but was unable to locate a suitable example/tutorial to study.

Any suggestions on where I could look would be highly appreciated!

Thanks, and best regards,
Ingolf


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Programmatically changing the Axis2 http port

Posted by sp...@me.com.
Hi Martin:

Thanks very much -- this was very helpful!

Best regards,
Ingolf

On Jun 3, 2013, at 3:53 AM, Martin Gainty <mg...@hotmail.com> wrote:

> Ingolf
> 
> Axis code is scoped at the session which means the 
> 1)axis2 web application does not know about session parameter port
> 2)container does not know about changes to session parameter port
> 
> If you want the port change for axis calls you will have to change the port in axis2.xml for sender or receiver e.g.
> 
> <transportSender>
>    <parameter name="port">8080</parameter>
> 
> <transportReceiver>
>   <parameter name="port">8080</parameter>
> 
> once you restart axis
> >netstat -ab | grep PORT
> 
> where port is the port number
> 
> you *should* see the port number
> 
> then utilities which operate outside of of your web-container will be able to contact axis service
> 
> curl --proxy AxisHost:PORT -d SOAP_REQUEST_GOES_HERE
> 
> Martin 
> ______________________________________________ 
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> 
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> 
> 
> 
> > Subject: Re: Programmatically changing the Axis2 http port
> > From: spihk@me.com
> > Date: Sun, 2 Jun 2013 21:11:41 -0700
> > To: java-user@axis.apache.org
> > 
> > Hi Shameera:
> > 
> > So I checked again, and what my code does is as follows (written in Java here for ease of discussion):
> > 
> > …
> > AxisServer server = new AxisServer();
> > server.getConfigurationContext.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(7171);
> > 
> > // some server.deployService(…) calls
> > 
> > …
> > 
> > Then, when I do 
> > 
> > server.getConfigurationContext.getAxisConfiguration().getTransportsIn().get("http").getParameter("port")
> > 
> > it returns 
> > 
> > 7171.
> > 
> > But when I do 
> > 
> > curl http://localhost:7171/axis2/services/Weather?wsdl
> > 
> > I get 
> > 
> > curl: (7) couldn't connect to host
> > 
> > If I do 
> > 
> > curl http://localhost:6060/axis2/services/Weather?wsdl
> > 
> > instead, I get the wsdl's XML.
> > 
> > So, somehow, the change of the port parameter doesn't "stick". Any suggestions?
> > 
> > Thanks,
> > Ingolf
> > 
> > 
> > 
> > 
> > On Jun 2, 2013, at 11:56 AM, Ingolf Krueger <sp...@me.com> wrote:
> > 
> > > Hi Shameera:
> > > 
> > > Thanks for your kind response.
> > > 
> > > I believe I did it exactly like you showed in your code. I took the configuration context from the newly instantiated Axis server and manipulated it the way you showed. Then, I added the services (implicitly starting the server).
> > > 
> > > When I then connected the client, I always got connection refused, even if I used the above approach to set it to the default port of 6060...
> > > 
> > > I'll show you the code when I am back at my machine.
> > > 
> > > Thanks,
> > > Ingolf
> > > 
> > > On Jun 2, 2013, at 11:17 AM, Shameera Rathnayaka <sh...@gmail.com> wrote:
> > > 
> > >> Hi Ingolf,
> > >> 
> > >> Transport listeners are initiated inside the org.apache.axis2.engine.ListenerManager#init method. you can change transport parameters by using below line of code here.
> > >> configctx.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(8090); // here i have set http listener port to 8090
> > >> 
> > >> You can access Axis Configuration from configuration context, Then you can retrieve all transportIn and transportOut configurations and manipulate them according to your need.
> > >> 
> > >> Cheers,
> > >> Shameera.
> > >> 
> > >> 
> > >> On Sun, Jun 2, 2013 at 7:37 AM, Ingolf Krueger <sp...@me.com> wrote:
> > >> Hi there --
> > >> 
> > >> I am trying to use Axis2 in embedded mode from within Clojure, and want to programmatically change the http port at which my services are presented so as to be able to run multiple independent Axis2 servers on the same box. I understand that this could be accomplished using axis2.xml, but I'd prefer to accomplish it via code.
> > >> 
> > >> I have searched the archives and documents, but was unable to locate a suitable example/tutorial to study.
> > >> 
> > >> Any suggestions on where I could look would be highly appreciated!
> > >> 
> > >> Thanks, and best regards,
> > >> Ingolf
> > >> 
> > >> 
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> > >> For additional commands, e-mail: java-user-help@axis.apache.org
> > >> 
> > >> 
> > >> 
> > >> 
> > >> -- 
> > >> Best Regards,
> > >> Shameera Rathnayaka.
> > >> 
> > >> email: shameera AT apache.org , shameerainfo AT gmail.com
> > >> Blog : http://shameerarathnayaka.blogspot.com/
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-user-help@axis.apache.org
> >


RE: Programmatically changing the Axis2 http port

Posted by Martin Gainty <mg...@hotmail.com>.
Ingolf

Axis code is scoped at the session which means the 
1)axis2 web application does not know about session parameter port
2)container does not know about changes to session parameter port

If you want the port change for axis calls you will have to change the port in axis2.xml for sender or receiver e.g.

<transportSender>
   <parameter name="port">8080</parameter>

<transportReceiver>
  <parameter name="port">8080</parameter>

once you restart axis
>netstat -ab | grep PORT

where port is the port number

you *should* see the port number

then utilities which operate outside of of your web-container will be able to contact axis service

curl --proxy AxisHost:PORT -d SOAP_REQUEST_GOES_HERE

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


> Subject: Re: Programmatically changing the Axis2 http port
> From: spihk@me.com
> Date: Sun, 2 Jun 2013 21:11:41 -0700
> To: java-user@axis.apache.org
> 
> Hi Shameera:
> 
> So I checked again, and what my code does is as follows (written in Java here for ease of discussion):
> 
> …
> AxisServer server = new AxisServer();
> server.getConfigurationContext.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(7171);
> 
> // some server.deployService(…) calls
> 
> …
> 
> Then, when I do 
> 
> server.getConfigurationContext.getAxisConfiguration().getTransportsIn().get("http").getParameter("port")
> 
> it returns 
> 
> 7171.
> 
> But when I do 
> 
> curl http://localhost:7171/axis2/services/Weather?wsdl
> 
> I get 
> 
> curl: (7) couldn't connect to host
> 
> If I do 
> 
> curl http://localhost:6060/axis2/services/Weather?wsdl
> 
> instead, I get the wsdl's XML.
> 
> So, somehow, the change of the port parameter doesn't "stick". Any suggestions?
> 
> Thanks,
> Ingolf
> 
> 
> 
> 
> On Jun 2, 2013, at 11:56 AM, Ingolf Krueger <sp...@me.com> wrote:
> 
> > Hi Shameera:
> > 
> > Thanks for your kind response.
> > 
> > I believe I did it exactly like you showed in your code. I took the configuration context from the newly instantiated Axis server and manipulated it the way you showed. Then, I added the services (implicitly starting the server).
> > 
> > When I then connected the client, I always got connection refused, even if I used the above approach to set it to the default port of 6060...
> > 
> > I'll show you the code when I am back at my machine.
> > 
> > Thanks,
> > Ingolf
> > 
> > On Jun 2, 2013, at 11:17 AM, Shameera Rathnayaka <sh...@gmail.com> wrote:
> > 
> >> Hi Ingolf,
> >> 
> >> Transport listeners are initiated inside the org.apache.axis2.engine.ListenerManager#init method. you can change transport parameters by using below line of code here.
> >> configctx.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(8090);  // here i have set http listener port to 8090
> >> 
> >> You can access Axis Configuration from configuration context, Then you can retrieve all transportIn and transportOut configurations and manipulate them according to your need.
> >> 
> >> Cheers,
> >> Shameera.
> >> 
> >> 
> >> On Sun, Jun 2, 2013 at 7:37 AM, Ingolf Krueger <sp...@me.com> wrote:
> >> Hi there --
> >> 
> >> I am trying to use Axis2 in embedded mode from within Clojure, and want to programmatically change the http port at which my services are presented so as to be able to run multiple independent Axis2 servers on the same box.  I understand that this could be accomplished using axis2.xml, but I'd prefer to accomplish it via code.
> >> 
> >> I have searched the archives and documents, but was unable to locate a suitable example/tutorial to study.
> >> 
> >> Any suggestions on where I could look would be highly appreciated!
> >> 
> >> Thanks, and best regards,
> >> Ingolf
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> >> For additional commands, e-mail: java-user-help@axis.apache.org
> >> 
> >> 
> >> 
> >> 
> >> -- 
> >> Best Regards,
> >> Shameera Rathnayaka.
> >> 
> >> email: shameera AT apache.org , shameerainfo AT gmail.com
> >> Blog : http://shameerarathnayaka.blogspot.com/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
> 
 		 	   		  

Re: Programmatically changing the Axis2 http port

Posted by sp...@me.com.
Hi Shameera:

So I checked again, and what my code does is as follows (written in Java here for ease of discussion):

…
AxisServer server = new AxisServer();
server.getConfigurationContext.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(7171);

// some server.deployService(…) calls

…

Then, when I do 

server.getConfigurationContext.getAxisConfiguration().getTransportsIn().get("http").getParameter("port")

it returns 

7171.

But when I do 

curl http://localhost:7171/axis2/services/Weather?wsdl

I get 

curl: (7) couldn't connect to host

If I do 

curl http://localhost:6060/axis2/services/Weather?wsdl

instead, I get the wsdl's XML.

So, somehow, the change of the port parameter doesn't "stick". Any suggestions?

Thanks,
Ingolf




On Jun 2, 2013, at 11:56 AM, Ingolf Krueger <sp...@me.com> wrote:

> Hi Shameera:
> 
> Thanks for your kind response.
> 
> I believe I did it exactly like you showed in your code. I took the configuration context from the newly instantiated Axis server and manipulated it the way you showed. Then, I added the services (implicitly starting the server).
> 
> When I then connected the client, I always got connection refused, even if I used the above approach to set it to the default port of 6060...
> 
> I'll show you the code when I am back at my machine.
> 
> Thanks,
> Ingolf
> 
> On Jun 2, 2013, at 11:17 AM, Shameera Rathnayaka <sh...@gmail.com> wrote:
> 
>> Hi Ingolf,
>> 
>> Transport listeners are initiated inside the org.apache.axis2.engine.ListenerManager#init method. you can change transport parameters by using below line of code here.
>> configctx.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(8090);  // here i have set http listener port to 8090
>> 
>> You can access Axis Configuration from configuration context, Then you can retrieve all transportIn and transportOut configurations and manipulate them according to your need.
>> 
>> Cheers,
>> Shameera.
>> 
>> 
>> On Sun, Jun 2, 2013 at 7:37 AM, Ingolf Krueger <sp...@me.com> wrote:
>> Hi there --
>> 
>> I am trying to use Axis2 in embedded mode from within Clojure, and want to programmatically change the http port at which my services are presented so as to be able to run multiple independent Axis2 servers on the same box.  I understand that this could be accomplished using axis2.xml, but I'd prefer to accomplish it via code.
>> 
>> I have searched the archives and documents, but was unable to locate a suitable example/tutorial to study.
>> 
>> Any suggestions on where I could look would be highly appreciated!
>> 
>> Thanks, and best regards,
>> Ingolf
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>> 
>> 
>> 
>> 
>> -- 
>> Best Regards,
>> Shameera Rathnayaka.
>> 
>> email: shameera AT apache.org , shameerainfo AT gmail.com
>> Blog : http://shameerarathnayaka.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Programmatically changing the Axis2 http port

Posted by Ingolf Krueger <sp...@me.com>.
Hi Shameera:

Thanks for your kind response.

I believe I did it exactly like you showed in your code. I took the configuration context from the newly instantiated Axis server and manipulated it the way you showed. Then, I added the services (implicitly starting the server).

When I then connected the client, I always got connection refused, even if I used the above approach to set it to the default port of 6060...

I'll show you the code when I am back at my machine.

Thanks,
Ingolf

On Jun 2, 2013, at 11:17 AM, Shameera Rathnayaka <sh...@gmail.com> wrote:

> Hi Ingolf,
> 
> Transport listeners are initiated inside the org.apache.axis2.engine.ListenerManager#init method. you can change transport parameters by using below line of code here.
> configctx.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(8090);  // here i have set http listener port to 8090
> 
> You can access Axis Configuration from configuration context, Then you can retrieve all transportIn and transportOut configurations and manipulate them according to your need.
> 
> Cheers,
> Shameera.
> 
> 
> On Sun, Jun 2, 2013 at 7:37 AM, Ingolf Krueger <sp...@me.com> wrote:
>> Hi there --
>> 
>> I am trying to use Axis2 in embedded mode from within Clojure, and want to programmatically change the http port at which my services are presented so as to be able to run multiple independent Axis2 servers on the same box.  I understand that this could be accomplished using axis2.xml, but I'd prefer to accomplish it via code.
>> 
>> I have searched the archives and documents, but was unable to locate a suitable example/tutorial to study.
>> 
>> Any suggestions on where I could look would be highly appreciated!
>> 
>> Thanks, and best regards,
>> Ingolf
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
> 
> 
> 
> -- 
> Best Regards,
> Shameera Rathnayaka.
> 
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/

Re: Programmatically changing the Axis2 http port

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Ingolf,

Transport listeners are initiated inside the
org.apache.axis2.engine.ListenerManager#init method. you can change
transport parameters by using below line of code here.
*
configctx.getAxisConfiguration().getTransportsIn().get("http").getParameter("port").setValue(8090);
*  // here i have set http listener port to 8090

You can access Axis Configuration from configuration context, Then you can
retrieve all transportIn and transportOut configurations and manipulate
them according to your need.

Cheers,
Shameera.


On Sun, Jun 2, 2013 at 7:37 AM, Ingolf Krueger <sp...@me.com> wrote:

> Hi there --
>
> I am trying to use Axis2 in embedded mode from within Clojure, and want to
> programmatically change the http port at which my services are presented so
> as to be able to run multiple independent Axis2 servers on the same box.  I
> understand that this could be accomplished using axis2.xml, but I'd prefer
> to accomplish it via code.
>
> I have searched the archives and documents, but was unable to locate a
> suitable example/tutorial to study.
>
> Any suggestions on where I could look would be highly appreciated!
>
> Thanks, and best regards,
> Ingolf
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
Best Regards,
Shameera Rathnayaka.

email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/