I have created a code where an external system can call wso2 esb over TCP and pass data, this is working fine without any issues however the reverse process is not happening and i am getting confused.
Here i would need to pass certain data to external system over TCP, however i am unable to do so as the parameters which are available while developing proxy doesn't contain IP address, it just contain port number, so i am curious as to how can the communication even be established when the IP address is not mentioned in the proxy.
Any help is appreciated.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TCPProxyClient"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<property name="symbol" scope="default" type="STRING" value="IBM"/>
<enrich>
<source clone="true" type="inline">
<m:getQuote xmlns:m="http://services.samples">
<m:request>
<m:symbol>?</m:symbol>
</m:request>
</m:getQuote>
</source>
<target type="body"/>
</enrich>
<enrich>
<source clone="true" property="symbol" type="property"/>
<target xmlns:m="http://services.samples" xpath="//m:getQuote/m:request/m:symbol"/>
</enrich>
<log level="full" separator=","/>
<send/>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
</target>
<parameter name="transport.tcp.responseClient">true</parameter>
<parameter name="transport.tcp.inputType">string</parameter>
<parameter name="transport.tcp.recordDelimiter">|</parameter>
<parameter name="transport.tcp.contentType">text/xml</parameter>
<parameter name="transport.tcp.port">8691</parameter>
<parameter name="transport.tcp.recordDelimiterType">character</parameter>
<description/>
</proxy>
The parameters above are used only when the proxy is listening for TCP messages. For sending a TCP message to a TCP socket, you need to define an endpoint in the send mediator.
<send>
<endpoint>
<address uri="tcp://localhost:8001/helloService"/>
</endpoint>
<send>
Follow the doc [1] to enable to TCP transport sender in axis2.xml.
Refer the question [2] for more info.
Related
I want to deploy my webapp with two different ports having two different deployment descriptors.
Is there a way to do so? I know how can I deploy a webapp on multiple ports. Wonder if we can provide separate deployment descriptor for an app being deployed on each connector.
<Service name="serviceA">
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="10"
enableLookups="false" acceptCount="100"
connectionTimeout="10000" disableUploadTimeout="true"
useBodyEncodingForURI="true"/>
<Engine name="serviceA" defaultHost="localhost" jvmRoute="host1">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
<Host name="localhost" appBase="webapps" unpackWARs="true"
autoDeploy="false" xmlValidation="false"
xmlNamespaceAware="false" xmlBase="PATH_TO_CUSTOM_web.xml">
<Context docBase="browser" path="/browser" reloadable="false"/>
</Host>
</Engine>
</Service>
<Service name="serviceB">
<Connector port="8081" maxHttpHeaderSize="8192" maxThreads="10"
enableLookups="false" acceptCount="100"
connectionTimeout="10000" disableUploadTimeout="true"
useBodyEncodingForURI="true"/>
<Engine name="serviceB" defaultHost="localhost" jvmRoute="host1">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
<Host name="localhost" appBase="webapps" unpackWARs="true"
autoDeploy="false" xmlValidation="false"
xmlNamespaceAware="false" xmlBase="PATH_TO_CUSTOM_web.xml">
<Context docBase="browser" path="/browser" reloadable="false"/>
</Host>
</Engine>
</Service>
Something like xmlBase="PATH_TO_CUSTOM_web.xml"
One can specify absolute path to the deployment descriptor instead of the default value.
altDDName
Ref: https://tomcat.apache.org/tomcat-8.5-doc/config/context.html
I'm using WSO2 Developer Studio 3.8.0 to work on ESB configuration and everytime i open a certain API definition file the IDE modify its content. The original file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/das/assets" name="wso2das-assets-management" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" protocol="http">
<inSequence>
<clone>
<target>
<sequence>
<log level="custom" separator=",">
<property expression="//*" name="Triggering EventStreamAdminService API call.."/>
</log>
<call>
<endpoint>
<address format="soap12" trace="disable" uri="https://192.168.219.142:9444/services/EventStreamAdminService.EventStreamAdminServiceHttpsSoap12Endpoint/"/>
</endpoint>
</call>
<log description="EventStreamAdminService API call response" level="full">
<property name="WSANSWER" value="true"/>
</log>
</sequence>
</target>
<target>
<sequence>
<log level="custom" separator=",">
<property expression="//*" name="Triggering EventStreamPersistenceAdminService API call.."/>
</log>
<call>
<endpoint>
<address format="soap12" trace="disable" uri="https://192.168.219.142:9444/services/EventStreamPersistenceAdminService.EventStreamPersistenceAdminServiceHttpsSoap12Endpoint/"/>
</endpoint>
</call>
<log
description="EventStreamPersistenceAdminService API call response" level="full">
<property name="WSANSWER" value="true"/>
</log>
</sequence>
</target>
</clone>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
And the file modified by the IDe once opened is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/das/assets" name="wso2das-assets-management" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" protocol="http">
<inSequence>
<clone>
<target>
<sequence>
<log level="custom" separator=",">
<property expression="//*" name="Triggering EventStreamAdminService API call.."/>
</log>
<call/>
<log description="EventStreamAdminService API call response" level="full">
<property name="WSANSWER" value="true"/>
</log>
</sequence>
</target>
<target>
<sequence>
<log level="custom" separator=",">
<property expression="//*" name="Triggering EventStreamPersistenceAdminService API call.."/>
</log>
<call/>
<log
description="EventStreamPersistenceAdminService API call response" level="full">
<property name="WSANSWER" value="true"/>
</log>
</sequence>
</target>
</clone>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
As you can see the content of the call tag (attribute and child tags) has been removed by the IDE once the file is opened. I suppose this is due to some best practice or restriction impose by the IDE. Any ideas?
This is a bug in devstudio, it is reported # https://wso2.org/jira/browse/TOOLS-3286 and fix will be avaialbe in next release. Will inform you the release date soon.
I am working on a Spring MVC application and I have deployed that on a Tomcat installation on the server. In the configuration which I will post below of Tomcat and Spring, HTTP communication occurs on port 80 and HTTPS on port 8443.
Now when the application is deployed, I can see in the browser URL as
https://domainname.com:8443/nameOfPage
I don't want want to show the port number to the user. What should I do, kindly let me know.
Thank you.
Spring Security config.xml
<security:http create-session="ifRequired" use-expressions="true" auto-config="true" disable-url-rewriting="true">
<security:form-login login-page="/"
default-target-url="/canvas/list"
always-use-default-target="false"
authentication-failure-url="/denied.jsp" />
<security:remember-me key="_spring_security_remember_me"
user-service-ref="userDetailsService"
token-validity-seconds="1209600"
data-source-ref="dataSource" />
<security:logout logout-success-url="/"
delete-cookies="JSESSIONID"
invalidate-session="true"
logout-url="/j_spring_security_logout" />
<security:intercept-url pattern="/" requires-channel="https" access="permitAll" />
<security:intercept-url pattern="/canvas/list" access="hasRole('ROLE_USER')" requires-channel="https" />
<security:port-mappings>
<security:port-mapping http="80" https="443" />
</security:port-mappings>
</security>
Apache Tomcat server.xml:
<Connector port="80"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443"
protocol="HTTP/1.1"
SSLEnabled="true"
maxThreads="150"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS"
keystoreFile="/path/to/keystore.jks"
keystorePass="password" />
The only way to achieve this is to use port 443 instead.
The browser will always tell you if you're using a non-standard port, and the standard port for HTTPS is 443.
Similarly, for HTTP if you use any port other than 80, the port number will show in the address bar.
I'm trying to create an API on wso2esb 4.8.1 that is able to use HTTP GET and POST. When a POST request is received the request has to be dispatched to two endpoints. This works fine and I've not added this piece in the example below.
But the HTTP GET request should be handled in a straightforward manner and this does not work. The request is not being forwarded at all and I'm only seeing a time out message in the ESB logs.
I've used wirehark to see if I see an outgoing request on the wire but this is not the case.
To me the HTTP GET looks pretty straight forward, nothing special at all, but it does not get send out by the ESB. Help would be greatly appreciated!
I've added my API description below:
<api xmlns="http://ws.apache.org/ns/synapse" name="myapp" context="/myapp/myservice">
<resource methods="GET">
<inSequence>
<log>
<property name="Message Flow" value="MyApp MyService API - IN"></property>
<property name="HTTP_METHOD IS###########" expression="$axis2:HTTP_METHOD"></property>
</log>
<property name="DISABLE_CHUNKING" value="true" scope="axis2" type="STRING"></property>
<property name="ContentType" value="application/json" scope="axis2" type="STRING"></property>
<property name="HTTP_METHOD" value="GET" scope="axis2"></property>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"></property>
<send>
<endpoint>
<address uri="http://myserver.com/myapp/myservice/myaction"></address>
</endpoint>
</send>
</inSequence>
<outSequence>
<property name="messageType" value="application/json" scope="axis2"></property>
<property name="ContentType" value="application/json" scope="axis2"></property>
<send></send>
</outSequence>
<faultSequence>
<log level="full">
<property name="MESSAGE" value="Executing default sequence"></property>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"></property>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"></property>
</log>
<drop></drop>
</faultSequence>
</resource>
</api>
In our system (closed system, java web application in tomcat 6 as server, java fat clients) our clients show occasionally "400 - Bad Request" responses. I would like to debug this on the server side, but since the requests seem to be invalid, I don't see them anywhere. I configured the AccessLogValve for the complete tomcat host, but the requests don't appear there. I don't even see anything in catalina.out.
I would love to get these requests logged and even better would be to dump requests based on certain criteria.
Any ideas?
My server.xml looks like this:
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
rmiServerPortPlatform="9098"
rmiRegistryPortPlatform="9099"
useLocalPorts="true" />
<Service name="Catalina">
<Connector port="8020" protocol="HTTP/1.1" redirectPort="8010" connectionTimeout="20000" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="cc1">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false"
deployOnStartup="true" xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="access_log."
suffix=".txt" pattern="combined" resolveHosts="false" />
</Host>
</Engine>
</Service>
</Server>
long time ago - but anyway: Tomcat has different Valves that may help to achieve that: http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Request_Dumper_Valve
Another option would be tcpdump since it is HTTP and a response code it seems possible to filter the raw requests that cause this.