Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. In <PRODUCT_HOME>/repository/conf/axis2/axis2.xml, edit the transportSender configuration of the http transport to specify the proxy server as follows:

    Code Block
    languagehtml/xml
    <transportSender name="http" class="org.apache.synapse.transport.nhttppassthru.HttpCoreNIOSenderPassThroughHttpSender">
    	<parameter name="non-blocking" locked="false">true</parameter>
    	<parameter name="http.proxyHost" locked="false">localhost</parameter>
    	<parameter name="http.proxyPort" locked="false">8080</parameter>
    </transportSender>
  2. In the Synapse configuration of the proxy service that sends messages to this proxy server, set the following two properties before the send mediator:

    Code Block
    languagehtml/xml
    <syn:property name="Proxy-Authorization" expression="fn:concat('Basic ', base64Encode('userName:password'))" scope="transport"/>
    <syn:property name="POST_TO_URI" value="true" scope="axis2"/>

    The first property sets the Proxy-Authorization HTTP transport header with the base64 encoded user name and password as expected by the HTTP basic authentication. The second property makes the outgoing URL a complete URL understandable by the proxy server.

...

Code Block
languagehtml/xml
linenumberstrue
<syn:proxy<proxy name="StockQuoteProxy" startOnLoad="true" xmlns="http://ws.apache.org/ns/synapse">
	<syn:target><target>
		<syn:inSequence><inSequence>
			<syn:property<property name="Proxy-Authorization" expression="fn:concat('Basic ', base64Encode('supun:test123'))" scope="transport"/>
			<syn:property<property name="POST_TO_URI" value="true" scope="axis2"/>
			<syn:send><send>
				<syn:endpoint<endpoint name="endpoint_urn_uuid_379C485AD3CB65037F10216600509076498395882">
					<syn:address<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
				</syn:endpoint>
			</syn:send>
		</syn:inSequence>
		<syn:outSequence><outSequence>
			<syn:send<send/>
		</syn:outSequence>
	</syn:target>
	<syn:publishWSDL<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</syn:proxy>
Excerpt
hiddentrue

Description of the HTTP Basic Authentication over a Proxy Server in WSO2 ESB.