Hi Rajika and Hiranya,

Thanks to both of you! It seems to be working now.
The plain text input message is being accepted.

I configured both the "port2 and "contentType" as parameters
in the proxy service. I removed all parameters from the tcp
section of the axis2 config file (see below).

By defining the endpoint.address.format to "pox", the soap wrapper
was removed, although still an xml wrapper around the "hello world" message.
Now I will work on my real endpoint - jms rather than http.

1. axis2.xml
<transportReceiver name="tcp" 
class="org.apache.axis2.transport.tcp.TCPTransportListener"/>
<transportSender name="tcp" 
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>

2. start_TCPlis_HTTP.xml
<definitions xmlns="http://ws.apache.org/ns/synapse";>
    <!-- Definitions for TCPTransportListener -->
    <proxy name="tcp2http" transports="tcp">
        <target>
            <inSequence>
                <property name="messageType" value="text/plain" scope="axis2"/>
                <property name="OUT_ONLY" value="true"/>
                <log level="full"/>
            </inSequence>
            <endpoint>
                <address uri="http://mdzhlfesb01:50000"; format="pox"/>
            </endpoint>
        </target>
        <parameter name="transport.tcp.port">6060</parameter> 
        <parameter name="transport.tcp.contentType">text/plain</parameter>
    </proxy>
</definitions>

3. Log output

3.1 Startup
2013-07-09T12:35:47,INFO 
,mdzhsfesb01,MSGMED,AbstractTransportListener.java:176,TCP Listener started
2013-07-09T12:35:47,INFO ,mdzhsfesb01,MSGMED,TCPServer.java:76,TCP server 
started on port : 6060
2013-07-09T12:35:47,INFO 
,mdzhsfesb01,MSGMED,Axis2SynapseController.java:280,Management using JMX 
available via: service:jmx:rmi:///jndi/rmi://mdzhsfesb01:1099/synapse
2013-07-09T12:35:47,INFO ,mdzhsfesb01,MSGMED,ServerManager.java:188,Server 
ready for processing...
2013-07-09T12:35:47,INFO ,mdzhsfesb01,MSGMED,SynapseServer.java:70,Apache 
Synapse started successfully

3.2 Message Input
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,ProxyServiceMessageReceiver.java:220,Proxy
 Service tcp2http received a new message...
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,ProxyServiceMessageReceiver.java:220,Message
 To: null
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,ProxyServiceMessageReceiver.java:220,SOAPAction:
 urn:mediate
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,ProxyServiceMessageReceiver.java:220,WSA-Action:
 urn:mediate
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,ProxyServiceMessageReceiver.java:220,Using
 the anonymous in-sequence of the proxy service for mediation
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Start : 
Sequence <anonymous>
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Sequence 
<SequenceMediator> :: mediate()
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Start : 
Property mediator
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Setting 
property : messageType at scope : axis2 to : text/plain (i.e. constant : 
text/plain)
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,End : Property 
mediator
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Start : 
Property mediator
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Setting 
property : OUT_ONLY at scope : default to : true (i.e. constant : true)
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,End : Property 
mediator
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,Start : Log 
mediator
2013-07-09T12:35:58,INFO ,mdzhsfesb01,MSGMED,MediatorLog.java:97,To: , 
WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: 
urn:uuid:4CE37AD6E70FB76ECB1373366158039, Direction: request, Envelope: <?xml 
version='1.0' encoding='utf-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><text 
xmlns="http://ws.apache.org/commons/ns/payload";>hello world
</text></soapenv:Body></soapenv:Envelope>
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,End : Log 
mediator
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MediatorLog.java:64,End : Sequence 
<anonymous>
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,ProxyServiceMessageReceiver.java:220,Forwarding
 the message to the anonymous endpoint of the proxy service
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,EndpointContext.java:366,Checking 
if endpoint : endpoint_a7f23b4f7341e05f9bb39e8cc1e715cc723bd430a3586de3 
currently at state ACTIVE can be used now?
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,AbstractEndpoint.java:460,Sending 
message through endpoint : 
endpoint_a7f23b4f7341e05f9bb39e8cc1e715cc723bd430a3586de3 resolving to address 
= http://mdzhlfesb01:50000
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,AbstractEndpoint.java:460,SOAPAction:
 urn:mediate
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,AbstractEndpoint.java:460,WSA-Action:
 urn:mediate
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,Axis2FlexibleMEPClient.java:110,Sending
 [add = false] [sec = false] [rm = false] [mtom = false] [swa = false] [format 
= pox] [force soap11=false] [force soap12=false] [pox=true] [get=false] 
[encoding=null] [to=http://mdzhlfesb01:50000]
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,Axis2FlexibleMEPClient.java:144,Message
 [Original Request Message ID : urn:uuid:4CE37AD6E70FB76ECB1373366158039] [New 
Cloned Request Message ID : urn:uuid:fb48792f-9544-48fd-a459-ff225f5f0a61]
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,SynapsePropertiesLoader.java:64,Retrieving
 synapse properties from the cache
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MiscellaneousUtil.java:51,The name 
with 'synapse.global_timeout_interval' cannot be found. Using default value : 
86400000
2013-07-09T12:35:58,INFO ,mdzhsfesb01,MSGMED,TimeoutHandler.java:68,This engine 
will expire all callbacks after : 86400 seconds, irrespective of the timeout 
action, after the specified or optional timeout
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,SynapsePropertiesLoader.java:64,Retrieving
 synapse properties from the cache
2013-07-09T12:35:58,DEBUG,mdzhsfesb01,MSGMED,MiscellaneousUtil.java:51,The name 
with 'synapse.timeout_handler_interval' cannot be found. Using default value : 
15000

4. SocketListener on Port 50000
POST  HTTP/1.1
Content-Type: application/xml; charset=UTF-8
SOAPAction: urn:mediate
Transfer-Encoding: chunked
Host: mdzhlfesb01:50000
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO


49
<text xmlns="http://ws.apache.org/commons/ns/payload";>hello world
</text>
0


timeout.

-----Original Message-----
From: Hiranya Jayathilaka [mailto:[email protected]] 
Sent: Montag, 8. Juli 2013 20:34
To: [email protected]
Subject: Re: Synapse: tcp-listener for plain text messages

I believe what Rajika has suggested should do the trick. You need to specify 
the content type at service level. This is because TCP is a transport layer 
protocol and Synapse has no other means of figuring out the media type of the 
received messages. 

The error you have posted implies that Synapse is unable to determine the TCP 
port for the service endpoint (this is the only required parameter). That's a 
little weird since you have specified it in axis2.xml. However if the problem 
persists try specifying the port number at the proxy service level as a 
parameter.

Thanks,
Hiranya

On Jul 8, 2013, at 8:18 AM, Rajika Kumarasiri <[email protected]> 
wrote:

> Please try having the parameter transport.tcp.contentType as a proxy
> service parameter.
> 
> <definitions xmlns="http://ws.apache.org/ns/synapse";>
>    <!-- Definitions for TCPTransportListener -->
>    <proxy name="tcp2http" transports="tcp" startOnLoad="true"
> trace="disable">
>        <target>
>            <endpoint>
>                <address uri="http://mdzhlfesb01:50000"/>
>            </endpoint>
>            <inSequence>
>                <property name="messageType" value="text/plain"
> scope="axis2"/>
>                <property name="OUT_ONLY" value="true"/>
>                <log level="full"/>
>            </inSequence>
>        </target>
>        <parameter name="transport.tcp.contentType">text/plain</parameter>
>    </proxy>
> </definitions>
> 
> And have the required builder in axis2.xml for the text/plain type.
> 
> Rajika
> 
> 
> On Mon, Jul 8, 2013 at 10:52 AM, Wright, Peter
> <[email protected]>wrote:
> 
>> Hi Rajika,
>> 
>> Do you see anything missing/incorrect in my configuration
>> that would explain it currently not working?
>> "Service doesn't have configuration information for transport tcp"
>> 
>> Peter
>> 
>> -----Original Message-----
>> From: Rajika Kumarasiri [mailto:[email protected]]
>> Sent: Montag, 8. Juli 2013 16:37
>> To: [email protected]
>> Subject: Re: Synapse: tcp-listener for plain text messages
>> 
>> I just looked at the source and it does properly uses the configured
>> builders. So you should be able to use it to read the syslog messages as
>> plain text messages.
>> 
>> Rajika
>> 
>> 
>> On Mon, Jul 8, 2013 at 5:30 AM, Wright, Peter <[email protected]
>>> wrote:
>> 
>>> I was hoping that the extensions made by Hiranja (support for content
>>> type) would solve my problem.
>>> Regarding the syslog message builder - I think that only supports the old
>>> (RFC 3164) syslog message format,
>>> whereas I need to support RFC 5424 format.
>>> Sounds like I can forget using synapse for this???
>>> 
>>> -----Original Message-----
>>> From: Rajika Kumarasiri [mailto:[email protected]]
>>> Sent: Freitag, 5. Juli 2013 17:07
>>> To: [email protected]
>>> Subject: Re: Synapse: tcp-listener for plain text messages
>>> 
>>> It seems the TCP listener always try to create a SOAP message ignoring
>>> any configured builders. There is a syslog message builder which could
>> have
>>> been used otherwise. This limitation has to fix in TCP listener.
>>> 
>>> Rajika
>>> 
>>> 
>>> On Fri, Jul 5, 2013 at 7:41 AM, Wright, Peter <
>> [email protected]
>>>> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I'm trying to configure synapse to receive syslog messages (RFC 5424)
>> via
>>>> tcp,
>>>> parse them, and according to certain properties (sender?), send as JMS
>>>> messages
>>>> to different topics in a messaging provider.
>>>> 
>>>> At the moment I'm trying to get the first part running - setup a
>>>> tcp-listener that accepts
>>>> plain text messages - and for now, just writes the message to HTTP (as
>> in
>>>> sample 265).
>>>> 
>>>> What I've done so far:
>>>> 
>>>> 1. Tried the TCPServer by copying "axis2-transport-tcp-1.0.0.jar" to
>>>> $SYNAPSE_HOME/libs
>>>> and using the following config:
>>>> 
>>>> 1.1 axis2.xml
>>>> <transportReceiver name="tcp"
>>>> class="org.apache.axis2.transport.tcp.TCPServer">
>>>>        <parameter name="port">6060</parameter>
>>>> </transportReceiver>
>>>> <transportSender name="tcp"
>>>> class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
>>>> 
>>>> 1.2 start_TCPsrv_HTTP.xml
>>>> <definitions xmlns="http://ws.apache.org/ns/synapse";>
>>>>    <!-- Input is a TCP request with a SYSLOG message file -->
>>>>    <!-- Definitions for TCPServer: -->
>>>>    <proxy name="tcp2Http" transports="tcp">
>>>>        <target>
>>>>            <inSequence>
>>>>                <log level="full"/>
>>>>            </inSequence>
>>>>            <outSequence>
>>>>                <log level="full"/>
>>>>                <send/>
>>>>            </outSequence>
>>>>            <endpoint>
>>>>                <address uri="http://mdzhlfesb01:50000"/>
>>>>            </endpoint>
>>>>        </target>
>>>>    </proxy>
>>>> </definitions>
>>>> 
>>>> It seems however, that only SOAP messages are supported by the
>> TCPServer
>>>> class
>>>> (kept on getting error messages about incorrect message format)
>>>> Sent the message "hello world" and got:
>>>> Unexpected character 'h' (code 104) in prolog; expected '<'
>>>> 
>>>> 
>>>> 2. Found this link about support for content-type being added to the
>>>> tcp-listener
>>>> 
>>>> 
>>> 
>> http://mail-archives.apache.org/mod_mbox/synapse-user/201102.mbox/raw/%[email protected]%3e/1
>>>> I found this web page and downloaded
>>>> "axis2-transport-tcp-1.1.0-SNAPSHOT.jar" from here:
>>>> 
>>>> 
>>> 
>> http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/axis2/axis2-transport-tcp/1.1.0-SNAPSHOT/
>>>> and copied it to $SYNAPSE_HOME/libs (renamed
>>> axis2-transport-tcp-1.0.0.jar
>>>> --> axis2-transport-tcp-1.0.0.jar.old)
>>>> 
>>>> 1.1 axis2.xml
>>>> <transportReceiver name="tcp"
>>>> class="org.apache.axis2.transport.tcp.TCPTransportListener">
>>>>        <parameter
>>> name="transport.tcp.contentType">text/plain</parameter>
>>>>        <parameter name="transport.tcp.port">6060</parameter>
>>>> </transportReceiver>
>>>> <transportSender name="tcp"
>>>> class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
>>>> 
>>>> 1.2 start_TCPlis_HTTP.xml
>>>> 
>>>> <!-- Taken from synapse sample 265: TCP -> HTTP -->
>>>> <definitions xmlns="http://ws.apache.org/ns/synapse";>
>>>>    <!-- Definitions for TCPTransportListener -->
>>>>    <proxy name="tcp2http" transports="tcp" startOnLoad="true"
>>>> trace="disable">
>>>>        <target>
>>>>            <endpoint>
>>>>                <address uri="http://mdzhlfesb01:50000"/>
>>>>            </endpoint>
>>>>            <inSequence>
>>>>                <property name="messageType" value="text/plain"
>>>> scope="axis2"/>
>>>>                <property name="OUT_ONLY" value="true"/>
>>>>                <log level="full"/>
>>>>            </inSequence>
>>>>        </target>
>>>>    </proxy>
>>>> </definitions>
>>>> 
>>>> At startup, I get the following warnings:
>>>> 2013-07-05T13:31:40,INFO
>>>> ,mdzhsfesb01,MSGMED,AbstractTransportListener.java:176,TCP Listener
>>> started
>>>> 2013-07-05T13:31:40,WARN
>>>> ,mdzhsfesb01,MSGMED,AbstractTransportListener.java:224,Unable to
>>> configure
>>>> the service tcp2http for the TCP transport: Service doesn't have
>>>> configuration information for transport tcp. This service is being
>> marked
>>>> as faulty and will not be available over the TCP transport.
>>>> 2013-07-05T13:31:40,WARN
>>>> ,mdzhsfesb01,MSGMED,AbstractTransportListener.java:192,Disabling the
>> tcp
>>>> transport for the service tcp2http, because it is not configured
>> properly
>>>> for the service
>>>> 
>>>> It seems I'm missing some configuration information for TCP, and the
>> TCP
>>>> service is then disabled.
>>>> Any help would be greatly appreciated!
>>>> 
>>>> Thanks,
>>>> Peter
>>>> 
>>>> The content of this e-mail is intended only for the confidential use of
>>>> the person addressed.
>>>> If you are not the intended recipient, please notify the sender and
>>> delete
>>>> this email immediately.
>>>> Thank you.
>>>> 
>>> The content of this e-mail is intended only for the confidential use of
>>> the person addressed.
>>> If you are not the intended recipient, please notify the sender and
>> delete
>>> this email immediately.
>>> Thank you.
>>> 
>> The content of this e-mail is intended only for the confidential use of
>> the person addressed.
>> If you are not the intended recipient, please notify the sender and delete
>> this email immediately.
>> Thank you.
>> 

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: [email protected];  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com

The content of this e-mail is intended only for the confidential use of the 
person addressed. 
If you are not the intended recipient, please notify the sender and delete this 
email immediately.
Thank you.

Reply via email to