13 Replies Latest reply on Dec 16, 2013 5:30 AM by liuliu

    use a different port for web service in jboss7

    liuliu

      hi,

       

      I have a web service runing on  the port 8080, I want to change this port to 8089(by example). I changed the conf in standalone.xhtml the wsdl-port to 8089, and restart the server.

       

      In the server.log, it is shown service is added on http://localhost:8089/myMetier/myService, but this address does not work.

      I cant get the wsdl when i try http://localhost:8089/myMetier/myService?wsdl, the old address still works, http://localhost:8080/myMetier/myService?wsdl

       

      what I missed?

       

      thanks in advance

       

      liumin

        • 1. Re: use a different port for web service in jboss7
          synclpz

          You should add a new socket-binding with your port, and set up an http-connector in web subsystem.

           

          1. Create new <socket-binding name="http-8089" port="8089"/>

          2. In subsystem "urn:jboss:domain:web" add <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http-8089"/>

          • 2. Re: use a different port for web service in jboss7
            liuliu

            Thank for your reply, it is what i missed. There is already a connector named http, so I changed the name of connector.

             

            Another question, Now we can get the web service by both 8080 and 8089. Is it possible use only 8089 for web service? On the same server, I have the web application running on the port 8080.

            • 3. Re: use a different port for web service in jboss7
              synclpz

              As I said you shouldn't have renamed the connector, you should just add another, so the following will work:

              Another question, Now we can get the web service by both 8080 and 8089. Is it possible use only 8089 for web service? On the same server, I have the web application running on the port 8080.

              if you have two connectors, one default "http" and one with another name (I mentioned it as "http-8089", it's just a name) referring another socket-binding.

               

              This way you will have your web server (serving web-app and ws) listen on both ports.

              • 4. Re: use a different port for web service in jboss7
                liuliu

                I cant add the connector if I dont change the name of the connector, I get this error message

                 

                Response

                 

                Internal Server Error

                {

                  "outcome" => "failed",

                  "failure-description" => "JBAS014803: Duplicate resource [

                  (\"subsystem\" => \"web\"),

                  (\"connector\" => \"http\")

                ]",

                  "rolled-back" => true

                }

                 

                If I keep the same name, just change the socket-binding, both the web-app and ws use the port 8089.

                What I want is the web-app and the ws use the different port, web-app on 8080 and web service on 8089.

                • 5. Re: use a different port for web service in jboss7
                  synclpz

                  I have this configuration in my standalone.xml:

                   

                  the web subsystem:

                   

                  <subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">

                              <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                              <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>

                              <connector name="http2" protocol="HTTP/1.1" scheme="http" socket-binding="http2" enabled="true"/>

                              <virtual-server name="default-host" enable-welcome-root="false">

                                  <alias name="localhost"/>

                                  <alias name="example.com"/>

                              </virtual-server>

                          </subsystem>

                   

                  and in socket-bindings:

                   

                  <socket-binding name="http" port="8080"/>

                  <socket-binding name="http2" port="8180" fixed-port="false"/>

                   

                  therefore web server listens on 8080 and 8180.

                  • 6. Re: use a different port for web service in jboss7
                    liuliu

                    hi,

                     

                    I have no doute about what you said, the server listens on port 8080 and 8180. but what I want is web-app and web service use different port. Is it possible?

                    by example, I dont want the web app is available on port 8180, and the web service is only available on port 8180.

                     

                    thanks

                    • 7. Re: use a different port for web service in jboss7
                      synclpz

                      Oh... I don't think it is possible via configuration. But programmatically you can check the URL in web-app and throw exception if port is not right and also implement an interceptor for WS to do the same thing.

                       

                      Or just start two jboss instances, for example :-)

                      • 8. Re: use a different port for web service in jboss7
                        liuliu

                        2 jboss instance, it could be a solution. but my web service is simple annotation on ejb method, and now it need creat a new projet for the web service. I dont like it.

                         

                        And I dont understand what it is for the wsdl-port parameter of webservice subsystem if we cant seperate web-app port and web-service port?

                        • 9. Re: use a different port for web service in jboss7
                          synclpz

                          I think it is actually important when a JBoss cluster is behind loadbalancer which uses different incoming port...

                          • 10. Re: use a different port for web service in jboss7
                            rhusar

                            I wonder if putting a loadbalancer in front of the single server and doing url rewriting would help your problem?

                             

                            host:8080/web-app -> host:8080/webapp

                            host:8180/web-service -> host:8080/web-service

                             

                            Othercases, 404 or whatever.

                            • 11. Re: use a different port for web service in jboss7
                              dlofthouse
                              And I dont understand what it is for the wsdl-port parameter of webservice subsystem if we cant seperate web-app port and web-service port?

                               

                              When WSDLs are processed / generated they need to contain the address of the endpoint in a way that the remote clients can use to connect to the server, due to various ways that servers can be configured the WS subsystem can not always be aware of the actual address a client will use to connect to the server - the wsdl-port attribute can be used to tell the ws subsystem the port that will be used.  It is not a mechanism to trigger the opening of a different port.

                              • 12. Re: use a different port for web service in jboss7
                                tkalafut

                                Test: Why won't the Discussion site let me create a question?

                                 

                                It lets me fill in everything and then says "cannot create or update content" at the top when I try to post.  Grrrrrr.

                                • 13. Re: use a different port for web service in jboss7
                                  liuliu

                                  thanks