Stop Retry in WSO2 ESB Endpoint - wso2-esb

I have used below endpoint property and want it to stop retry hit but still it is retrying. I want only one hit to endpoint whether it is success or failure.
<endpoint name="DecisionGatewayProxy_EPR">
<address uri="http://XXXX:8280/soap/XXXX">
<timeout>
<duration>20000</duration>
<responseAction>fault</responseAction>
</timeout>
<markForSuspension>
<errorCodes>101504, 101505</errorCodes>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>1</retryDelay>
</markForSuspension>
<suspendOnFailure>
<errorCodes>101500, 101501, 101506, 101507, 101508</errorCodes>
<initialDuration>20000</initialDuration>
<progressionFactor>0.0</progressionFactor>
</suspendOnFailure>
</address>
</endpoint>

AFAIK the default behavior is sending a single request. And if it fails ESB marks it as timed out.So IMO it won't try again automatically upon time out. But if you need to mark the endpoint as SUSPENDED you can make <retriesBeforeSuspension>0</retriesBeforeSuspension>
value into 1. So this will mark the endpoint SUSPENDED after single endpoint failure.
Hope this helps.

I do not think that it is possible to do it in WSO2 ESB. As a suggestion, make sure to send a response from the server regardless of success or failure (at least send 202 ACCEPTED) then it will not retry to send the same message.

Related

WSO2 - Forward response from REST (called from WSO2) to JMS queue

I've faced an issue, with trying to forward message, returned from my custom REST end-point, into JMS queue.
I wanted to implement something like:
SMTH CUSTOM IS PUSHING MESSAGE TO WSO2 JMS QUEUE called testQueue
WSO2 is retrieving this message, and once there is an message, it's pushing this message next to custom REST service:
Becasue I've defined receive to testResponse inside send section, I'm able to log reponse from REST API inside testResponse.
Now I'm stuck, as I'm trying to somehow push response from REST API next, to let say second JMS queue, called testQueue2.
I've already tried with call tags inside my custom sequence (called testReponse), but it's just not executing at all (I've also tried for test, just to execute second REST API inside, to be just sure, if it's not something with executing of JMS itself...):
Any ideas, how I can move response from called REST API on to JMS queue?
Thanks.
<proxy name="testQueue" startOnLoad="true" transports="jms">
<target>
<inSequence>
<send receive="testResponse">
<endpoint>
<http format="rest" method="POST" uri-template="http://localhost/customRestAPI?message=test" />
</endpoint>
</send>
</inSequence>
<outSequence />
</target>
</proxy>
<sequence name="testResponse">
<log level="full" />
</sequence>
Try adding an "Out Flow" mediation extension as explained here.

BizTalk WCF Timeout Issue

I have a orchestration in BizTalk which is collect to data via web services from SAP.
My process is as below.
We have a SOAP service on receive port and when we get an request from SOAP we transform it to SAP RFC File format and send it to SAP. When we try to get a response from SAP we get an error when response data is big. If response message size is so big our service get a timeout error. Otherwise there is a no problem if the message size is not big.
I tried to increase timeout duration on BizTalk management console but still fails. Whatever I did, the timeout duration is always in 1 minutes.
After Adding below XML config tags to machine.config file I get an error as below figure.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
<configuration>
<system.transactions>
<machineSettings maxTimeout="00:20:00" />
</system.transactions>
</configuration>
Below image is SAP Send Port
SAP Send Port Details
In the detail as you can see my time out duration about 10 hour but in SOAP UI I get an timeout error after 1 minute.
Below image is Receive Port
Also you can find biztalk event viewer error as below.
A response message sent to adapter "SOAP" on receive port "WebPort_SAP/MusteriFaturaT/ABC_SAP_Fatura_T_FaturaOrch_InvoiceReceivePort" with URI "/SAP/MusteriFaturaT/ABC_SAP_Fatura_T_FaturaOrch_InvoiceReceivePort.asmx" is suspended.
Error details: The original request has timed out. The response arrived after the timeout interval and it cannot be delivered to the client.
And SOAPUI response screen is blank as below
On WCF Custom send port, change the value of time out (close, open, send, receive) to increase timeout. See the link for more details
You can also use SOAPUI tool to test your web service outside BizTalk to see the response time and response size.
Problem is about SOAP UI timeout issue. When i change the timeout property of SOAP our timeout duration was increase to 110 second. 110 second is default soap timeout duration. For fix this issue you have to add below config options to web.config file.
<system.web>
<httpRuntime executionTimeout="43200" />
</system.web>
Also you have to add below configs to client app.config file.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IBRAHIM_SAP_Fatura_T_FaturaOrch_InvoiceReceivePortSoap" maxReceivedMessageSize="2147483647" receiveTimeout="03:00:00"
sendTimeout="02:00:00" transferMode="Streamed"/>
</basicHttpBinding>
</bindings>
</system.serviceModel>
UPDATE:
Now we have the error it is indicating that it is the client that timed out rather than BizTalk, in this case SoapUI. As per the answer from this question SoapUI: ConnectException: Connection timed out:
Default socket timeout is set to 60000 milliseconds. You can change it:
File -> Preferences -> HTTP Settings -> Socket Timeout
When you are connecting with another client, you will also have to check/set the timeouts in that.
ORIGINAL POST:
If you are using BizTalk 10 or above check the response timeout on the host is set to a value greater than a minute.
I had an issue with Timeouts as well an this was one setting I changed (in this case to the maximum).
You can set up a specific Host for large transactions where the Response timeout in minutes is changed and only those ports that need it use it.
However even after I changed that to the maximum value I encountered a timeout after 15 minutes.
For that I had to disable Use Transaction, only do this if you still encounter issues and you are retrieving data and not inserting/changing data.
The above images are from my blog post about the issue BizTalk Server Negative Acknowledgement issues in SAP and WCF.
As to setting the system.transaction setting in the config, that is rather dangerous to do as it will affect everything, not just that port.
You have to increase your timeout in the machine.config file
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
<configuration>
<system.transactions>
<machineSettings maxTimeout="00:20:00" />
</system.transactions>
</configuration>
You must also set the property allowExeDefinition to "MachineToApplication" from "MachineOnly"

How to get real result from AxisEngine

I'm trying to implement my specific transport for WSO2 ESB based on some proprietary binary protocol. From protocol specification I need acknowledge every packet I receive only if I'm 100% sure that it will be processed in future. For those reasons some persistent store must be used.
I want to implement that protocol logic via WSO2 ESB sequence that gets protocol packets/messages and stores them to temporary messageStore which is used as a queue in producer/consumer pattern (where producer is transport itself and consumer is my packet processor).
I have to be sure that my packet got to the messageStore before sending acknowledge to the client. But AxisEngine.receive() does always return CONTINUE even if message store is not available.
The configuration of the proxy is:
<proxy name="MyProxyService">
<target>
<inSequence>
<store messageStore="MyStore" sequence="onStoreSequence"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
<makefault version="soap11" response="true">
<code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
<reason expression="get-property('ERROR_MESSAGE')"/>
</makefault>
<send/>
</faultSequence>
</target>
</proxy>
The code I use in transport is:
MessageContext msgContext = confContext.createMessageContext();
AxisConfiguration axisConf = confContext.getAxisConfiguration();
try {
msgContext.setTransportIn(axisConf.getTransportIn(transportName));
msgContext.setTransportOut(axisConf.getTransportOut(transportName));
msgContext.setIncomingTransportName(Constants.TRANSPORT_LOCAL);
msgContext.setAxisService(axisConf.getService("MyProxyService"));
msgContext.setEnvelope(TransportUtils.createSOAPMessage(msgContext));
msgContext.setServerSide(true);
Handler.InvocationResponse response = AxisEngine.receive(msgContext);
log.error(String.valueOf(response));
} catch (Exception e) {
log.error("ERROR", e);
}
The behaviour I want to have is what I see in HTTP transport: http request from the client (SOAP UI) is translated to Axis2 MessageContext and delivered to MyProxyService. If everything is ok - I get positive response, otherwise - error code and SOAP fault.
After additional investigation I can say that idea behind HTTP transport request/response is that for sending response the HttpSender not HttpReceiver is used. HttpReceiver gets request from HTTP connection, sets link to HTTP connection to the message context, uses AxisEngine.receive() to deliver message to the ESB and returns.
HTTP response itself is received via HttpSender, identified as response to the previous request (via empty To header) and sent to the connection referenced from the message context.

wso2 : ESB faultsequence

how to use faultsequence of proxy in esb
i want to use faultsequence when occur a fault in EndPoint. for example i stop service1 using jconsole and want to route message to service2 when call proxy service. but when i call proxy using soapui it show fault this message : The system is attempting to access an inactive service..
<target>
<inSequence >
<send>
<endpoint name="cal" >
<address uri="http://localhost:9763/services/service1/"/>
</endpoint>
</send>
</inSequence>
<faultSequence>
<log level="custom">
<property name="text" value="An unexpected error occured for service"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
</log>
<send>
<endpoint>
<address uri="http://localhost:9763/services/service2/"/>
</endpoint>
</send>
</faultSequence>
please guide me!
When your endpoint 1 is inactive it returns a soap fault and you want it to go to the fault sequence. But at the moment that fault sequence is considered as a response and it is sent to the client (soap ui).
In WSO2 ESB 4.5.0 onwards, there is a new property FORCE_ERROR_ON_SOAP_FAULT added. By setting this property, soap faults will be directed to fault sequence. You can do your next logics when you are in the fault sequence (for example invoking another sequence).
Refer [1] for a sample proxy service.
[1] http://maharachchi.blogspot.com/2012/09/now-you-can-send-soapfaults-to-fault.html
I believe your exact scenario is apart of your main end point if it faild you need to route the message to secondary endpoint.
Correct approach to your implementation is not using the fault sequence right approach is using fail over endpoint. You can find reference document at [1][2].
For sample you can refer "Sample 53: Failover sending among 3 endpoints" [3].
[1].http://wso2.org/project/esb/java/3.0.1/docs/endpoint_guide.html#FoEp
[2].http://docs.wso2.org/wiki/display/ESB403/Failover+Endpoint
[3].http://wso2.org/project/esb/java/3.0.1/docs/samples/endpoint_mediation_samples.html
Thank You,
Dharshana.

Error accesing published WS proxy in WSO2 ESB 4.6: EPR not found

I deployed exactly the same WS-proxy in 4.5.1 and 4.6. With 4.5.1 it works correctly, but with 4.6 I get:
ERROR - AxisEngine The endpoint reference (EPR) for the Operation not found is /services/registro.registroHttpSoap11Endpoint and the WSA Action = . If this EPR was previously reachable, please contact the server administrator.
The source is the following:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="registro" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="http://localhost:15080/SIGEM_RegistroPresencialWS/services/ServicioRegistroWebService"/>
</endpoint>
</target>
<publishWSDL uri="http://localhost:15080/SIGEM_RegistroPresencialWS/services/ServicioRegistroWebService?wsdl"/>
<description></description>
</proxy>
What do I have to do for 4.6. to make it work?
Thanx.
To enhance ESB performance pass-through transport has been enabled by default starting from ESB 4.6.0 version that is not the case for ESB 4.5.1. It seems your proxy service depends on SOAP body based dispatching but pass-through transport does not support for SOAP body based dispatching. SOAP body based dispatching build the message body and use first element's local name for dispatching which effect to proxy performance badly that is the reason it was not supported in pass-through transport. We are in a process to fix this limitation for future ESB releasees without loosing any advantage of pass-through transport.
BTW for the moment you can use one of the following workarounds.
When sending a messages to the proxy service append operation name to the endpoint URL
e.g - http://serverName/app/serviceName/operationName
Modify client level code to send expected SOAPAction value ( like Try-It case)
I'm not sure your backend service's WSDL defined "" as the value of SOAPAction if that is the case you may modified the backend service to have value other than "" per each operation. AS an example for JAX-WS services you can use #WebMethod annotation for this.
e.g - #WebMethod(action="XXXX")
Note : In case if your backend WSDL defining a value other than "" for SOAPAction while your client send message with SOAPAction="" then it's a violation of service contract by the client and need to be fixed on client level.
I have faced the same problem with wso2 ESB 4.7 and the web service is also developed by me for the company.
What worked for me is adding soapAction attribute to wsdl soap:operation element like below.
<soap:operation soapAction="http://localhost:8080/MyWebApp/services/hello" style="document"/>