By default, if you deploy a proxy service in vanilla WSO2 ESB, you will see it points to localhost. If you need to change that to some URL (i.e point to the load balancer url), there is a few configurations to be done.
In this article I am adding "www.wso2.org:8280" as a prefix to all service URLs in ESB.
127.0.0.1 www.wso2.org
That's it!. You will now see all proxy services are prefixed properly.
In this article I am adding "www.wso2.org:8280" as a prefix to all service URLs in ESB.
Edit /ect/hosts file
Edit above as following and add following entry127.0.0.1 www.wso2.org
Edit Carbon.xml
Edit following entries in [ESB_HOME]/repository/cont/carbon.xml file.<!-- Host name or IP address of the machine hosting this server e.g. www.wso2.org, 192.168.1.10 This is will become part of the End Point Reference of the services deployed on this server instance. --> <HostName>www.wso2.org</HostName> <!-- Host name to be used for the Carbon management console --> <MgtHostName>mgt.wso2.org</MgtHostName>
Edit Axis2.xml file
ESB uses PassThrough listeners. They should be configured to use the WSDL prefix and a bind address. Edit [ESB_HOME]/repository/conf/axis2/axis2.xml file as below.
<transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener"> <parameter name="port" locked="false">8280</parameter> <parameter name="non-blocking" locked="false">true</parameter> <parameter name="bind-address" locked="false">www.wso2.org</parameter> <parameter name="WSDLEPRPrefix" locked="false">https://www.wso2.org:8280</parameter> <parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.PassThroughNHttpGetProcessor</parameter> <!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>--> </transportReceiver> <transportReceiver name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLListener"> <parameter name="port" locked="false">8243</parameter> <parameter name="non-blocking" locked="false">true</parameter> <parameter name="bind-address" locked="false">www.wso2.org</parameter> <parameter name="WSDLEPRPrefix" locked="false">https://www.wso2.org:8243</parameter> <parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.PassThroughNHttpGetProcessor</parameter> <parameter name="keystore" locked="false"> <KeyStore> <Location>repository/resources/security/wso2carbon.jks</Location> <Type>JKS</Type> <Password>wso2carbon</Password> <KeyPassword>wso2carbon</KeyPassword> </KeyStore> </parameter> <parameter name="truststore" locked="false"> <TrustStore> <Location>repository/resources/security/client-truststore.jks</Location> <Type>JKS</Type> <Password>wso2carbon</Password> </TrustStore> </parameter> <!--<parameter name="SSLVerifyClient">require</parameter> supports optional|require or defaults to none --> </transportReceiver>
That's it!. You will now see all proxy services are prefixed properly.
Doing this for Application Server
If you do this to application server, edit the same carbon.xml and axis2.xml files. In axis2.xml file edit as below (insert bind url and wsdl prefix tags).
<transportReceiver name="http" class="org.wso2.carbon.core.transports.http.HttpTransportListener"> <!-- Uncomment the following if you are deploying this within an application server. You need to specify the HTTP port of the application server --> <parameter name="bind-address" locked="false">www.wso2.org</parameter> <parameter name="WSDLEPRPrefix" locked="false">http://www.wso2.org:9763/</parameter> <parameter name="port">9763</parameter> <!-- Uncomment the following to enable any proxy like Apache2 mod_proxy or any load balancer. The port on the proxy server like Apache is 80 in this case. --> <!--<parameter name="proxyPort">80</parameter>--> </transportReceiver> <transportReceiver name="https" class="org.wso2.carbon.core.transports.http.HttpsTransportListener"> <!-- Uncomment the following if you are deploying this within an application server. You need to specify the HTTPS port of the application server --> <parameter name="bind-address" locked="false">www.wso2.org</parameter> <parameter name="WSDLEPRPrefix" locked="false">http://www.wso2.org:9443/</parameter> <parameter name="port">9443</parameter> <!-- Uncomment the following to enable any proxy like Apache2 mod_proxy or any load balancer. The port on a proxy server like Apache is 443 in this case. --> <!--<parameter name="proxyPort">443</parameter>--> </transportReceiver>
No comments:
Post a Comment