WSO2 ESB: suspended anonymousendpoint - esb

I am working on WSO2 ESB 4.8.1 and facing an issue regarding to suspended anonymous endpoint. The scenario is: TCP/IP transport receiver (custom one) -> Proxy -> invoke HTTP endpoint.
At the startup runtime, my custom transport receiver will connect to another machine by using TCP/IP protocol and start listener message event. When message event come, the transport receiver will format the message event as JSON format and send it to predefined Proxy (This step is working well even though suspended anonymous endpoint has been occurred). The implement in side the proxy is really simple, just send to HTTP endpoint:
<property name="messageType" value="application/json" scope="axis2" />
<property name="Accept" scope="transport" value="application/json" />
<payloadFactory media-type="json">
<format>$1</format>
<args>
<arg evaluator="json" expression="$.eventMessage" />
</args>
</payloadFactory>
<call>
<endpoint>
<http method="post" uri-template="http://localhost:9080/goal"></http>
</endpoint>
</call>
The process is working fine except the suspended anonymous endpoint has happened (Such as the HTTP endpoint is shutdown), then i am able to see a log message as below:
WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint : AnonymousEndpoint - current suspend duration is : 30000ms - Next retry after : Tue Oct 28 17:38:23 ICT 2014
If i stop the request traffic at the transport receiver and restart the HTTP endpoint, after 30 ms the endpoint can back to service
In case request traffic at the transport receiver still running, i saw the log message above is displayed few times and then the ESB server don't log that message anymore. At this time, the HTTP endpoint is suspended and never come back to service except restarting ESB server
I also saw this log message:
WARN {org.apache.synapse.core.axis2.TimeoutHandler} - Expiring message ID : urn:uuid:5dcedb38-3f9a-4a75-a201-ae4e76428216; dropping message after global timeout of : 120 seconds
That is really strange for me and i wonder if i did something wrong here. I really need your suggestion guys
Best regards,
An

Use a named endpoint and configure suspension and timeout, have a look there : https://docs.wso2.com/display/ESB481/Endpoint+Error+Handling
If you don't want to loose any message and if your http endpoint can be down for a long time for exemple, you should consider using guaranteed delivery with message Store and message Processor, have a look there : https://docs.wso2.com/display/IntegrationPatterns/Guaranteed+Delivery

Related

WSO2 Enterprise Integrator Unable to call deployed API

I am completely new to WSO2 and I am facing the problem described below.
After deploying the API (composite application *.car file) I am unable to invoke the services of the defined endpoints from WSO2 ESB.
The REST API I am trying to invoke is found deployed on a local tomcat installation, and is located at:
http://localhost:8080/CustomerInfoRestService/customers/
To retrieve a json customer object I would simply add the customer id, like so:
http://localhost:8080/CustomerInfoRestService/customers/2
All the services operations (Get, POST, PUT, DELETE) are tested and invoked successfully. For testing I used the tool 'PostMan'.
I created an ESB project using the WSO2 Integration Studio.
First I defined an endpoint with a URI Template of:
http://localhost:8080/CustomerInfoRestService/customers/{uri.var.custId}
Then I defined a REST API. The properties of the API Resource are as follows:
URL-Style: URI_Template
URI-Template: /customers/{custId}
Methods: GET
In the In-Sequence I added a log mediator, having:
Log Category: INFO
Log Level: CUSTOM
and I defined its message as:
Property Name: message
Property value type: LITERAL
Property Value: Welcome to Customer Service
Directly next to the log mediator is a 'Send' mediator, and I included the defined endpoint above.
Then I deploy the composite application as: right-click -> Export Composite Application Project.
I include both the API and and the endpoint in the generated *.car file.
Now to invoke an API request, I call the service using 'curl':
curl -v http://localhost:8280/CustomerInfoRestService/customers/2
and I get the response:
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8280 (#0)
> GET /CustomerInfoRestService/customers/2 HTTP/1.1
> Host: localhost:8280
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Thu, 13 Jun 2019 10:09:06 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
It seems not to be found (404 error)
I followed the WSO2 documentation, specifically the integration tutorial "Sending a Simple Message to a Service" to create this project, for reference it is found at:https://docs.wso2.com/display/EI650/Sending+a+Simple+Message+to+a+Service
Any help is greatly appreciated.
Thanks in advance,
Kind Regards,
This kind of response comes when the API is not deployed or active in the ESB. Did you deploy the car file you created? You did not mention that in your steps. Please make sure that you are able to see the API in the management console (Home -> Service Bus -> API).

Direct logback logs to graylog

I have a third party java application which uses logback for logging.
I want to add a Socket Appender to the application's logback.xml as specified in the documentation
(https://logback.qos.ch/manual/appenders.html)
<configuration debug="true">
<appender name="SERVER"
class="ch.qos.logback.classic.net.server.ServerSocketAppender">
<port>${port}</port>
<includeCallerData>${includeCallerData}</includeCallerData>
</appender>
<root level="debug">
<appender-ref ref="SERVER" />
</root>
</configuration>
The purpose is to direct the logs to graylog using udp end point.
Is there a way to send the logs using the UDP protocol ?
Thanks for your time.
There are multiple GELF appenders for Logback listed on the Graylog Marketplace:
https://marketplace.graylog.org/addons?tag=logback
Personally, I'd recommend using logstash-gelf.
I created a TCP Socket Server application (say on port 1234 running on localhost).
I added a socket appender to the logback.xml of the third party application to send logs to the TCP Server application.
<appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
<remoteHost>localhost</remoteHost>
<port>1234</port>
<reconnectionDelay>10000</reconnectionDelay>
<includeCallerData>true</includeCallerData>
</appender>
Now, on the Socket server application, I added the logstash-gelf dependency and appender that joschi recommended.
Now the logs from the third party application go thru a hop and then reach Graylog.
The one caveat that I had to get around was to determine the severity of the log from the log message before logging it again in the socket server application.

ejabberd mod_multicast won't allow relaying

I am using the latest (commit 9574e71e8db595ce7b2fa2f8fbfc38deec2ad74b) version of ejabberd and tries to make the mod_multicast module work, but I'm failing.
I have this:
modules:
mod_multicast:
host: "multicast.cego.dk"
allow: all
which I believe should work, however I get this response when sending a massage:
<message from="multicast.cego.dk"
to="robert78#komogvind.dk/13809541201432712492488165"
type="error">
<addresses xmlns="http://jabber.org/protocol/address">
<address type="to"
jid="betatester01#komogvind.dk"/>
<address type="to"
jid="robert78#komogvind.dk"/>
<body>
Hello, World!
</body>
</addresses>
<error code="403"
type="auth">
<forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
Packet relay is denied by service policy
</text>
</error>
</message>
Why is this?
I also tried with 'allow: admin' and 'allow: multicast' and then defining a multicast acl as described in the documentation but all attempts fail.
The "multicast.cego.dk" service shows up in service discovery and I can query it with service discovery.
At the moment, ejabberd only support multicasting to local user and does not support relaying.
I created a feature request for you on ejabberd ticket tracker:
https://github.com/processone/ejabberd/issues/583

Mule ESB cxf client config

I'm using mule cxf client to consume web services. How can I change default configuration of the mule cxf client? What I need is to change "Keep-Alive header". Other option is to change http protocol version to set it to 1.0, if that is posible? Thank you.
<cxf:jaxws-client operation="updateParcelDetails"
clientClass="com.pb.pts.service.endpoint.TrackingserviceV10"
port="ParcelTrackingServiceEndpoint_V1_0Port"
wsdlLocation="classpath:wsdl/TrackingV10.wsdl" />
This is controlled by the HTTP transport, not the CXF module.
The HTTP transport doc says:
Attributes of <outbound-endpoint...>
keep-alive | boolean | Controls if the socket connection is kept alive. If set to true, a keep-alive header with the connection timeout specified in the connector will be returned. If set to false, a "Connection: close" header will be returned.
Have you tried it?

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM’

I have an ASP.NET web application written in VB.NET. One part of the application makes an AJAX call to an internal ASMX file which in turn makes a call to a remote web service which is just a single ASMX file. Normally this works fine and has been deployed a couple of times and works fine. One client however, is getting the message from the AJAX call:
The HTTP request is unauthorized with client authentication scheme
'Anonymous'. The authentication header received from the server was
'NTLM’.
I have scoured a large amount of websites trying to fix this but I can’t seem to find any answer that works for me.
I have been unable to replicate the error on my test server, which is the same as the client, Win2003 IIS6.
The remote web service is deployed on Windows 2008 r2 – IIS7.5. The remote service is deployed using ‘Anonymous’ authentication only. The client deployment is set up with Anonymous and ‘Integrated Windows Authentication’. I have tried changing the authentication levels on both implementations but cannot replicate the issue. The closest I have come is when I set the remote service IIS authentication to
The HTTP request is unauthorized with client authentication scheme
'Ntlm'. The authentication header received from the server was ''.
In the web.config file the reference to the remote service is:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SVCMappingSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://svc.website.com/services/myService.asmx" binding="basicHttpBinding" bindingConfiguration="SVCMappingSoap" contract="SVCMappingService.SVCMappingSoap" name="SVCMappingSoap"/>
</client>
</system.serviceModel>
I have tried changing a number of the setting in the <security> section but still unable to replicate.
I am not sure of your total server setup.
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
</security>
instead of above one please try with below configuration
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
please go through below links, you can more idea on those and you can change the config based on your requirements:
http://blogs.msdn.com/b/publicsector/archive/2005/10/19/482833.aspx
http://fczaja.blogspot.com/2009/10/http-request-is-unauthorized-with.html
http://ddkonline.blogspot.com/2009/11/fix-http-request-is-unauthorized-with.html
I had to change the default generated
<security mode="Transport"/>
into
<security mode="Transport" >
<transport clientCredentialType="Ntlm"/>
</security>
One more comment for this problem:
If you are not using HTTPS,
<security mode="Transport"/>
is not supported. You can use
<security mode="TransportCredentialOnly">
instead.