I have a wso2 esb 4.7.0 proxy with an inline endpoint and inline configurations like suspendOnFailure ormarkForSuspension.
The <markForSuspension><errorCodes>-1 (never suspend) is very important for all my endpoints. So far I need to copy/paste the whole configuration tags for each endpoint.
How can I change the default value for markForSuspension?
Then I would not have to give the whole configuration for each endpoint anymore.
<?xml version="1.0" encoding="UTF-8"?>
<proxy>
<!-- .... -->
<send>
<endpoint>
<address uri="##To##">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
</endpoint>
</send>
</inSequence>
</target>
</proxy>
AFAIK, you cannot change the default values unless you modify the code (and recompile).
I would recommend you to create a template for you endpoint. See Sample 752
For example, you can try following configuration.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestProxy"
transports="http"
statistics="enable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint name="ep_name"
template="ep_template"
uri="##To##"/>
</send>
</inSequence>
...
</target>
</proxy>
Following is the template for endpoint
<template xmlns="http://ws.apache.org/ns/synapse" name="ep_template">
<endpoint name="$name">
<address uri="$uri">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
</endpoint>
</template>
I hope this helps
Related
I was about implement a workflow of a Job using many calls mediators , each one it works perfect until i put them together so it didn't work and it give me this WARN in my console
[2022-12-19 16:55:03,026] INFO {SourceHandler} - Writer null when calling informWriterError
[2022-12-19 16:55:03,027] WARN {SourceHandler} - STATE_DESCRIPTION = Socket Timeout occurred after accepting the request headers and the request body, INTERNAL_STATE = REQUEST_DONE, DIRECTION = REQUEST, CAUSE_OF_ERROR = Connection between the client and the EI timeouts, HTTP_URL = /NumSequence, HTTP_METHOD = GET, SOCKET_TIMEOUT = 180000, CLIENT_ADDRESS = /127.0.0.1:57800, CONNECTION http-incoming-3 Correlation ID : dd34a03b-a3e6-4f6a-a254-230076b41246
this is my code :
The first API execute an SQL Statement of drop
The second API execute an SQL Statement of create
The third API execute an SQL Statement select
The forth API execute an SQL Statement of update
<api context="/NumSequence" name="NumSequence" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<call>
<endpoint>
<http method="get" uri-template="http://ebs-dev:8290/services/RADMINDataService/numseqdrop">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<call>
<endpoint>
<http method="get" uri-template="http://ebs-dev:8290/services/RADMINDataService/numseqcreate">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<call>
<endpoint>
<http method="get" uri-template="http://ebs-dev:8290/services/CRMDataService/ReadUsername">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<iterate expression="//accounts/account">
<target>
<sequence>
<payloadFactory media-type="json" template-type="freemarker">
<format><![CDATA[{
"_postaddusername": {
"NumSequence":${payload.account.NumSequence},
"Prefixe":"${payload.account.Prefixe}"
}
}]]></format>
<args/>
</payloadFactory>
<call>
<endpoint>
<http method="post" uri-template="http://ebs-dev:8290/services/RADMINDataService/AddUsername">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
</sequence>
</target>
</iterate>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
I'm trying to call an endpoint from a sequence using WSO2 Integration Studios. Whenever I define the endpoint in-line, my code works fine and I get a response from the endpoint. Whenever I define the endpoint as a separate entity, it stops working and I get the following error-message: "MESSAGE = An unexpected error occurred., REST_API = null, ERROR_CODE = 305100, ERROR_MESSAGE = Couldn't find the endpoint with the key..."
My code looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XMLSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log category="TRACE" description="Log Request Payload"/>
<call description="Send request to the endpoint">
<endpoint key="TestEndpoint" />
</call>
</sequence>
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="TestEndpoint" xmlns="http://ws.apache.org/ns/synapse">
<http method="get" uri-template="https://[api]">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
For reference, my code does work when it looks like this:
`<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XMLSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log category="TRACE" description="Log Request Payload"/>
<call description="Send request to the endpoint">
<endpoint name="TestEndpoint" xmlns="http://ws.apache.org/ns/synapse">
` <http method="get" uri-template="https://[api]">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
</sequence>
This "Couldn't find the endpoint with the key.." error occurred when EI/ESB cannot find the endpoint configuration in the synapse configuration space.
Check whether you have added it to the composite application project when bundling all the synapse xml artefacts to the .car file.
I am re-factorizing a wso2 project and I wondered how/whether I could do the following. This project is designed to send data to a SOAP Api. In every environment, this API exposes a .wsdl file and the URL and credentials are the only things changing from one environment to another. The most natural thing to do is thus to
create those in the Registry and
load it in the beginning of the job like so
<propertyGroup>
<property expression="get-property('registry', 'gov:/endpoints/sap_constructionSiteUser')" name="sap_constructionSiteUser" scope="default" type="STRING"/>
<property expression="get-property('registry', 'gov:/endpoints/sap_constructionSitePassword')" name="sap_constructionSitePassword" scope="default" type="STRING"/>
<property expression="get-property('registry', 'gov:/endpoints/sap_constructionSiteUrl')" name="uri.var.sap_constructionSiteUrl" scope="default" type="STRING"/>
</propertyGroup>
But I could not find a straightforward way to use this uri.var.sap_constructionSiteUrl in the endpoint definition. The following does not work
<call>
<endpoint>
<wsdl optimize="mtom" uri="{uri.var.sap_constructionSiteUrl}" port="OUVERTURE_CHANTIER" service="OUVERTURE_CHANTIER" statistics="enable">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</wsdl>
</endpoint>
</call>
Looks like uri= only accept plain value. Is there a way I could made this dynamic without writing the entire endpoint in the Registry (the point is to keep things simple for the clients)
[Environment]
wso2ei 6.5.0
====================EDIT========================
I just created a template:
<template name="crm4sap-constructionSiteTemplate" xmlns="http://ws.apache.org/ns/synapse">
<axis2ns488:parameter name="port" xmlns:axis2ns488="http://ws.apache.org/ns/synapse"/>
<axis2ns489:parameter name="service" xmlns:axis2ns489="http://ws.apache.org/ns/synapse"/>
<axis2ns490:parameter name="uri" xmlns:axis2ns490="http://ws.apache.org/ns/synapse"/>
<endpoint name="$name">
<wsdl port="$port" service="$service" uri="$uri">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</wsdl>
</endpoint>
</template>
And I call it with
<call>
<endpoint name="constructionSiteEndpoint" template="crm4sap-constructionSiteTemplate">
<axis2ns468:parameter name="port" value="OUVERTURE_CHANTIER" xmlns:axis2ns468="http://ws.apache.org/ns/synapse"/>
<axis2ns469:parameter name="service" value="OUVERTURE_CHANTIER" xmlns:axis2ns469="http://ws.apache.org/ns/synapse"/>
<axis2ns469:parameter name="uri" value="{$ctx:sap_constructionSiteUrl}" xmlns:axis2ns469="http://ws.apache.org/ns/synapse"/>
</endpoint>
</call>
Variable substitution does not seem to occur:
[2020-04-15 12:30:54,032] [] WARN - TemplateEndpointFactory Could not read the WSDL endpoint {$ctx:sap_constructionSiteUrl}
java.net.MalformedURLException: no protocol: {$ctx:sap_constructionSiteUrl}
at java.net.URL.<init>(URL.java:600)
at java.net.URL.<init>(URL.java:497)
at java.net.URL.<init>(URL.java:446)
Looks like a common problem
You can try to template this endpoint and then call the template with the parameters. You can pass dynamic values to the template in the runtime.
https://docs.wso2.com/display/EI650/Endpoint+Template
I was able to do it using the following code in the sequence:
<call-template target="template-for-calling-soap">
<with-param name="url" value="{get-property('soap-uri')}"/>
</call-template>
Where soap-uri is a local entry or a simple property, and the sequence template named template-for-calling-soap takes as parameter the url value and has the following code:
<template name="template-for-calling-soap"
xmlns="http://ws.apache.org/ns/synapse">
<parameter name="url"/>
<sequence>
<property expression="$func:url" name="uri.var" scope="default"
type="STRING"/>
<send>
<endpoint>
<address format="soap11" uri="${uri.var}"/>
</endpoint>
</send>
</sequence>
</template>
i have a proxy service that call a web service . sometimes it send out error code 303001 and after refresh it work again . my mind of refresh is i open admin panel in list of service choose design view of my service and click next next finish. after that service work correctly and after 1 hour it throw out error code
my service :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="BillVerification"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<class name="org.sample.mediators.citydi.HashMediatorCityDI"/>
<log level="full" category="FATAL">
<property name="fprever" value="justyou"/>
</log>
<property name="DISABLE_CHUNKING"
value="true"
scope="axis2"
type="STRING"/>
<send>
<endpoint>
<address uri="http://checkbill2.citydi.net/CheckBill.asmx?wsdl" format="soap12">
<suspendOnFailure>
<initialDuration>100000000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>100000000</maximumDuration>
</suspendOnFailure>
</address>
</endpoint>
</send>
<log level="full" category="FATAL">
<property name="send1" value="send1"/>
</log>
</inSequence>
<outSequence>
<log level="full">
<property name="beforeSENDout" value="2"/>
</log>
<send/>
<log level="full" category="FATAL">
<property name="send2" value="send2"/>
</log>
</outSequence>
</target>
<publishWSDL uri="http://checkbill2.citydi.net/CheckBill.asmx?wsdl"/>
<description/>
</proxy>
303001 = Address Endpoint is not ready to connect
Perhaps because of a corporate proxy / firewall ?
You'r wrong thinking your endpoint is active always : use a named endpoint instead of your anonymous one and have a look to wso2 web console : I guess it will be deactivated (the "action" become "Switch on")
In your case, with an anonymous endpoint, when you edit / save your proxy, the endpoint is switched on.
If you don't want your endpoint to be suspended add something like this :
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
If you don't want your endpoint to manage a specific timeout, add something like this :
<markForSuspension>
<errorCodes>-1</errorCodes>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
I'm using wso2esb 4.7.0 and wso2dss 3.0.0. Their are multiple services on server i wish to use load balancing endpoint.For that i went through documents.I have cleared my concept but in littlebit confusion that how to implement that in actual proxy service.I have created a load balance endpoint as :
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="TestAddressEndpoint">
<session type="http">
<sessionTimeout>0</sessionTimeout>
</session>
<loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
<endpoint name="Addressdetail_endp">
<address uri="http://localhost:9764/services/maddress_Dataservice/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
<endpoint name="Addressdetail_endp2.0">
<address uri="http://localhost:9764/services/maddress_Dataservice2.0/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
<endpoint name="Addressdetail_endp3.0">
<address uri="http://localhost:9764/services/maddress_Dataservice3.0/">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
</loadbalance>
</endpoint>
Now i wanted to ask that how can i used this endpoint in actual proxy service? Should i make changes in axis2.xml file?
Have a look at this sample. Or else if you can refer to a saved endpoint as below;
<target endpoint="TestAddressEndpoint"/>
Using this is a proxy service;
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MyProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target endpoint="TestAddressEndpoint"/>
<description/>
...
</proxy>