Hi Devs,
I am opening up this thread to discuss $subject.
Recently, I did some improvements [1] to the Axis2 local transport, inorder
to get it working against Synapse nhttp transport. Now the local transport
is working fine against the nhttp transport.
Now, my requirement is to expose an Synapse Proxy Service only in local
transport. The reason behind is that, these proxy services which are exposed
only in local transport will be used by other proxy services and will not be
available for outside parties. Earlier, axis2 local transport did not have a
TransportListener.
With a TransportListener
====================
I introduced [2] a TransportListener to the local transport. The transport
listener's methods are used to calculate the endpoints for the service which
will be used in generating the WSDL for the service. Therefore, now if the
service exposed in the local transport, the local endpoint is also shown in
the WSDL. Although the local endpoints are shown in the WSDL, outside
parties can not access the local endpoint.
The problem this patch introduce is, now the WSDL shows the local transport
endpoints. Which is wrong since external users can not access local
transport.
So the solution is not to show the local transport endpoints in generated
wsdl. For that we may have to change Axis2 code.
eg: As an example, I am attaching the following resources to prove my point.
The synapse-config.xml is the Synapse Configuration and the attached WSDLs
are for the proxy servivces, LocalTransportProxy and SecondProxy. The
SecondProxy is exposed only via the local transport and the local endpoints
are shown in the WSDL which is wrong IMV.
Without a TransportListener
======================
If we did not have a LocalTransportListener and if a service is exposed
through local transport only, the WSDL for the service will not be
generated. The reason behind is that; inorder to generate the WSDL, there
should be a mechanism to derive the endpoints for the service. Since, the
TransportListener is not there, there is no mechanism to derive the
endpoints for the service(which is only exposed through the local
transport).
In case the service exposed through http,https,local transports; this wont
be the case. Then the WSDL will be generated and only the http,https
endpoints will be shown.
Without the listener, if we expose a service only in local transport, WSDL
generation fails since the endpoints can not be derived for that particular
service.
Your ideas and feedback on $subject is much appreciated.
[1] - https://issues.apache.org/jira/browse/AXIS2-4944
[2] - https://issues.apache.org/jira/browse/AXIS2-5043
--
Regards,
Heshan Suriyaarachchi
http://heshans.blogspot.com/
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="SecondProxy" transports="local" startOnLoad="true" trace="disable">
<target>
<endpoint name="ep2">
<address uri="local://localhost/services/StockQuoteProxy"/>
</endpoint>
<inSequence>
<log level="full"/>
<log level="custom">
<property name="SecondProxy" value="In sequence of Second proxy invoked!"/>
</log>
</inSequence>
<outSequence>
<log level="custom">
<property name="SecondProxy" value="Out sequence of Second proxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<proxy name="StockQuoteProxy" startOnLoad="true">
<target>
<endpoint name="ep3">
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<outSequence>
<log level="custom">
<property name="StockQuoteProxy" value="Out sequence of StockQuote proxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<proxy name="LocalTransportProxy" transports="https http" startOnLoad="true" trace="disable">
<target>
<endpoint name="ep1">
<address uri="local://localhost/services/SecondProxy"/>
</endpoint>
<inSequence>
<log level="full"/>
<log level="custom">
<property name="LocalTransportProxy" value="In sequence of LocalTransportProxy invoked!"/>
</log>
</inSequence>
<outSequence>
<log level="custom">
<property name="LocalTransportProxy" value="Out sequence of LocalTransportProxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default "fault" sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="main">
<log/>
<drop/>
</sequence>
</definitions>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://services.samples" xmlns:ns1="http://services.samples/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://services.samples">
<wsdl:documentation>SimpleStockQuoteService</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax21="http://services.samples/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://services.samples/xsd">
<xs:element name="getQuote">
<xs:complexType>
<xs:sequence>
<xs:element name="request" type="ns1:GetQuote"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuote" type="ns1:GetQuote"/>
<xs:complexType name="GetQuote">
<xs:sequence>
<xs:element name="symbol" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="getQuoteResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="ns1:GetQuoteResponse"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuoteResponse" type="ns1:GetQuoteResponse"/>
<xs:complexType name="GetQuoteResponse">
<xs:sequence>
<xs:element name="change" type="xs:double"/>
<xs:element name="earnings" type="xs:double"/>
<xs:element name="high" type="xs:double"/>
<xs:element name="last" type="xs:double"/>
<xs:element name="lastTradeTimestamp" type="xs:string"/>
<xs:element name="low" type="xs:double"/>
<xs:element name="marketCap" type="xs:double"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="open" type="xs:double"/>
<xs:element name="peRatio" type="xs:double"/>
<xs:element name="percentageChange" type="xs:double"/>
<xs:element name="prevClose" type="xs:double"/>
<xs:element name="symbol" type="xs:string"/>
<xs:element name="volume" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="placeOrder">
<xs:complexType>
<xs:sequence>
<xs:element name="order" type="ns1:PlaceOrder"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PlaceOrder" type="ns1:PlaceOrder"/>
<xs:complexType name="PlaceOrder">
<xs:sequence>
<xs:element name="price" type="xs:double"/>
<xs:element name="quantity" type="xs:int"/>
<xs:element name="symbol" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getQuoteMessage">
<wsdl:part name="part1" element="ns1:getQuote"/>
</wsdl:message>
<wsdl:message name="getQuoteResponseMessage">
<wsdl:part name="part1" element="ns1:getQuoteResponse"/>
</wsdl:message>
<wsdl:message name="placeOrderMessage">
<wsdl:part name="part1" element="ns1:placeOrder"/>
</wsdl:message>
<wsdl:portType name="LocalTransportProxyPortType">
<wsdl:operation name="getQuote">
<wsdl:input message="axis2:getQuoteMessage" wsaw:Action="urn:getQuote"/>
<wsdl:output message="axis2:getQuoteResponseMessage" wsaw:Action="//services.samples/SimpleStockQuoteServicePortType/getQuoteResponse"/>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<wsdl:input message="axis2:placeOrderMessage" wsaw:Action="urn:placeOrder"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="LocalTransportProxySoap11Binding" type="axis2:LocalTransportProxyPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getQuote">
<soap:operation soapAction="urn:getQuote" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<soap:operation soapAction="urn:placeOrder" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="LocalTransportProxySoap12Binding" type="axis2:LocalTransportProxyPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getQuote">
<soap12:operation soapAction="urn:getQuote" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<soap12:operation soapAction="urn:placeOrder" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="LocalTransportProxyHttpBinding" type="axis2:LocalTransportProxyPortType">
<http:binding verb="POST"/>
<wsdl:operation name="getQuote">
<http:operation location="getQuote"/>
<wsdl:input>
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<http:operation location="placeOrder"/>
<wsdl:input>
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="LocalTransportProxy">
<wsdl:port name="LocalTransportProxyHttpSoap11Endpoint" binding="axis2:LocalTransportProxySoap11Binding">
<soap:address location="http://localhost:8280/services/LocalTransportProxy.LocalTransportProxyHttpSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="LocalTransportProxyHttpsSoap11Endpoint" binding="axis2:LocalTransportProxySoap11Binding">
<soap:address location="https://localhost:8243/services/LocalTransportProxy.LocalTransportProxyHttpsSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="LocalTransportProxyHttpSoap12Endpoint" binding="axis2:LocalTransportProxySoap12Binding">
<soap12:address location="http://localhost:8280/services/LocalTransportProxy.LocalTransportProxyHttpSoap12Endpoint"/>
</wsdl:port>
<wsdl:port name="LocalTransportProxyHttpsSoap12Endpoint" binding="axis2:LocalTransportProxySoap12Binding">
<soap12:address location="https://localhost:8243/services/LocalTransportProxy.LocalTransportProxyHttpsSoap12Endpoint"/>
</wsdl:port>
<wsdl:port name="LocalTransportProxyHttpEndpoint" binding="axis2:LocalTransportProxyHttpBinding">
<http:address location="http://localhost:8280/services/LocalTransportProxy.LocalTransportProxyHttpEndpoint"/>
</wsdl:port>
<wsdl:port name="LocalTransportProxyHttpsEndpoint" binding="axis2:LocalTransportProxyHttpBinding">
<http:address location="https://localhost:8243/services/LocalTransportProxy.LocalTransportProxyHttpsEndpoint"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://services.samples" xmlns:ns1="http://services.samples/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://services.samples">
<wsdl:documentation>SimpleStockQuoteService</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax21="http://services.samples/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://services.samples/xsd">
<xs:element name="getQuote">
<xs:complexType>
<xs:sequence>
<xs:element name="request" type="ns1:GetQuote"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuote" type="ns1:GetQuote"/>
<xs:complexType name="GetQuote">
<xs:sequence>
<xs:element name="symbol" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="getQuoteResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="ns1:GetQuoteResponse"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuoteResponse" type="ns1:GetQuoteResponse"/>
<xs:complexType name="GetQuoteResponse">
<xs:sequence>
<xs:element name="change" type="xs:double"/>
<xs:element name="earnings" type="xs:double"/>
<xs:element name="high" type="xs:double"/>
<xs:element name="last" type="xs:double"/>
<xs:element name="lastTradeTimestamp" type="xs:string"/>
<xs:element name="low" type="xs:double"/>
<xs:element name="marketCap" type="xs:double"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="open" type="xs:double"/>
<xs:element name="peRatio" type="xs:double"/>
<xs:element name="percentageChange" type="xs:double"/>
<xs:element name="prevClose" type="xs:double"/>
<xs:element name="symbol" type="xs:string"/>
<xs:element name="volume" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="placeOrder">
<xs:complexType>
<xs:sequence>
<xs:element name="order" type="ns1:PlaceOrder"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PlaceOrder" type="ns1:PlaceOrder"/>
<xs:complexType name="PlaceOrder">
<xs:sequence>
<xs:element name="price" type="xs:double"/>
<xs:element name="quantity" type="xs:int"/>
<xs:element name="symbol" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getQuoteMessage">
<wsdl:part name="part1" element="ns1:getQuote"/>
</wsdl:message>
<wsdl:message name="getQuoteResponseMessage">
<wsdl:part name="part1" element="ns1:getQuoteResponse"/>
</wsdl:message>
<wsdl:message name="placeOrderMessage">
<wsdl:part name="part1" element="ns1:placeOrder"/>
</wsdl:message>
<wsdl:portType name="SecondProxyPortType">
<wsdl:operation name="getQuote">
<wsdl:input message="axis2:getQuoteMessage" wsaw:Action="urn:getQuote"/>
<wsdl:output message="axis2:getQuoteResponseMessage" wsaw:Action="//services.samples/SimpleStockQuoteServicePortType/getQuoteResponse"/>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<wsdl:input message="axis2:placeOrderMessage" wsaw:Action="urn:placeOrder"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SecondProxySoap11Binding" type="axis2:SecondProxyPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getQuote">
<soap:operation soapAction="urn:getQuote" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<soap:operation soapAction="urn:placeOrder" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SecondProxySoap12Binding" type="axis2:SecondProxyPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getQuote">
<soap12:operation soapAction="urn:getQuote" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="placeOrder">
<soap12:operation soapAction="urn:placeOrder" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SecondProxy">
<wsdl:port name="SecondProxyLocalSoap11Endpoint" binding="axis2:SecondProxySoap11Binding">
<soap:address location="local://localhost/services/SecondProxy.SecondProxyLocalSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="SecondProxyLocalSoap12Endpoint" binding="axis2:SecondProxySoap12Binding">
<soap12:address location="local://localhost/services/SecondProxy.SecondProxyLocalSoap12Endpoint"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]