I'm in an internel network and I want to create a service (ESB) to call an external get service.
for example my ESB service path: uri/esb/path/param1/param2
my external path: external/path/param1/param2
here my entry
<?xml version="1.0" encoding="UTF-8"?>
<api context="/services/KRI-getIndividualVehicleFuelco2" name="KRI-getIndividualVehicleFuelco2" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<property name="renault_error_format" scope="default" type="STRING" value="json"/>
<log level="custom">
<property name="getIndividualVehicleFuelco2" value="********** begin **********"/>
<property expression="get-property('RequestID')" name="RequestID"/>
</log>
<Delegation.DelegationIn>
<Jboss-Endpoint-Key>KRI-customAddressingTransformation.xml</Jboss-Endpoint-Key>
<Custom-Sequence-Header>KRI-commonsequences-processSpecialHeadersIn</Custom-Sequence-Header>
</Delegation.DelegationIn>
<loopback/>
</inSequence>
<outSequence>
<sequence key="KRI-commonsequences-genericErrorHandling"/>
<Delegation.DelegationOut>
<Jboss-Endpoint-Key>KRI-customAddressingTransformation.xml</Jboss-Endpoint-Key>
<Custom-Sequence-Header>KRI-commonsequences-processSpecialHeadersOut</Custom-Sequence-Header>
</Delegation.DelegationOut>
<log level="custom">
<property name="getIndividualVehicleFuelco2" value="********** end **********"/>
<property expression="get-property('RequestID')" name="RequestID"/>
</log>
</outSequence>
<faultSequence>
<loopback/>
</faultSequence>
</resource>
</api>
I created an endpoint with the base uri of the external service.
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="KIS-fuelco-PPD" xmlns="http://ws.apache.org/ns/synapse">
<address uri="http://kisre701.intra.com/kis/api/v2/individual-vehicle-fuelco2/"/>
</endpoint>
how can I parse parameters and send them to endpoint?
Related
I have published a websocket api as given in the Documentation, So I wanted to call that websocket API through wso2 ESB. So, how to pass the Auth header as I'm getting the following error on the console.
[2018-10-02 18:24:36,503] ERROR - InboundWebsocketSourceHandler Endpoint not found for port : 9099 tenant domain : null
Below is the ESB to call websocket API:
<api context="/test" name="test" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<log level="full">
<property name="message" value="********************************************input**********************"/>
</log>
<property name="Authorization" scope="transport" type="STRING" value="Bearer cf920eb2-960c-383c-b556-78e9258fd8d3"/>
<send>
<endpoint>
<http method="post" uri-template="ws://localhost:9099/echowebsocket/1.0"/>
</endpoint>
</send>
</inSequence>
<outSequence>
</outSequence>
<faultSequence/>
</resource>
</api>
outflow sequence:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="outflowDispatchSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="full">
<property name="message" value="************************************************"/>
</log>
</sequence>
In wso2 ESB, I am able to send data to WebSocket but I am not able to receive data.
I tried this with rest api of wso2 esb.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/test" name="test" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<log level="full">
<property name="message" value="********************************************input**********************"/>
</log>
<send>
<endpoint>
<http method="post" uri-template="ws://localhost:8080/websocket/server"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
</api>
outsequence:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="outflowDispatchSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="full">
<property name="message" value="************************************************"/>
</log>
</sequence>
with the above API, I am able to send data to the server as shown in below image.
Http request from postman.
But as shown in below image of the console, the response which i am getting is empty as no body present.
If I use proxy service with content-type mentioned as in esb documentation(link) in websocket server i am getting exception
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="dispatchSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<property name="websocket.accept.contenType" scope="axis2" value="text/plain"/>
<send>
<endpoint>
<address uri="ws://localhost:8080/websocket/server"/>
</endpoint>
</send>
</sequence>
axis2.xml websocket configuration is:
<transportSender name="ws" class="org.wso2.carbon.websocket.transport.WebsocketTransportSender">
<parameter name="ws.outflow.dispatch.sequence" locked="false">outflowDispatchSeq</parameter>
<parameter name="ws.outflow.dispatch.fault.sequence" locked="false">outflowFaultSeq</parameter>
</transportSender>
So how to send and receive the data from websocket
I working on WSO2 ESB profile for sap adapter. I followed the step for configuring sap adapter with WSO2 as mentioned in manual. But yet after starting the server, I am not able to create BapiSender proxy service in management console. It is marked default with the error
SAPTransportListener Unable to configure the service BAPISender for the BAPI transport: Service doesn't have configuration information for transport bapi. This service is being marked as faulty and will not be available over the BAPI transport.
WARN - SAPTransportListener Disabling the bapi transport for the service BAPISender, because it is not configured properly for the service.
Can you post your proxy service? Below you'll find a working example proxy.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SAPProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<payloadFactory media-type="xml" description="BAPIPayload">
<format>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<bapirfc xmlns="" name="Z_CONVERT_IBAN_2_BANK_ACCOUNT">
<import>
<field name="I_IBAN">123456789</field>
</import>
</bapirfc>
</soap:Body>
</soap:Envelope>
</format>
<args/>
</payloadFactory>
<send>
<endpoint name="sap-endpoint">
<address uri="bapi:/yourconf"/>
</endpoint>
</send>
<log level="full">
<property name="step" value="--- AFTER SEND TO SAP 2 --"/>
</log>
</inSequence>
<outSequence>
<log level="full">
<property name="step" value="--- RESULT FROM SAP --"/>
</log>
<send/>
</outSequence>
<faultSequence>
<log level="full">
<property name="step" value="--- FAULT --"/>
</log>
<drop/>
</faultSequence>
</target>
<description/>
</proxy>
We have created proxy service in wso2 esb using esb project in eclipse.
We have two web service calls and a data mapper.
proxy service is giving error "2017-02-23 12:06:32,131 [-] [HTTP-Listener I/O dispatcher-4] WARN SourceHandler Connection time out after request is read: http-incoming-40 Socket Timeout : 180000 Remote Address : /10.65.0.75:52864" as we add data mapper.
Without data mapper proxy service is running successfully. some times it also runs successfully with data mapper.
can someone guide about this issue?
Following is the proxy source
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EslSfaOFAOMSOIntegrationPS"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<call>
<endpoint>
<address format="soap11"
uri="http://10.1.6.175:9763/services/EslSfaOMSODataService.SOAP11Endpoint/"/>
</endpoint>
</call>
<log level="full"/>
<datamapper config="gov:datamapper/EslSfaOFAOMSOIntegrationMapping.dmc"
inputSchema="gov:datamapper/EslSfaOFAOMSOIntegrationMapping_inputSchema.json"
inputType="XML"
outputSchema="gov:datamapper/EslSfaOFAOMSOIntegrationMapping_outputSchema.json"
outputType="XML"/>
<log description="" level="full"/>
<header name="Authorization"
scope="transport"
value="Basic --"/>
<log level="full"/>
<call>
<endpoint>
<address format="soap11"
uri="https://oraclefusionhost:443/soa-infra/services/default/DooDecompReceiveOrderExternalComposite/ReceiveOrderRequestService"/>
</endpoint>
</call>
<log level="full"/>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<description/>
</proxy>
calling proxy through scheduled task, attached is the source
<task class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz" name="testtask2">
<trigger count="1" interval="60"/>
<property name="proxyName" value="EslSfaOFAOMSOIntegrationPS" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="soapAction" value="operation" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<soapenv:Envelope xmlns:esl="esl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<esl:operation/>
</soapenv:Body>
</soapenv:Envelope>
</property>
</task>
Secondly how can we have the response from proxy service. our web-service create record in db and return status success when run stand alone form soap ui.
Replace <drop/> with a <respond />
I configure two proxies in ESB, and these 2 proxies are bridged to one instance mediator. And I have different property set for mediator in proxy configuration.
I expect that the two mediators instances are running in ESB with different properties.
But in fact, seems only mediator instance is in ESB.
Any idea on this?
I made a mistake here. In java code, spring bean is used to contain mediator property configured in xml file. But spring bean is singleton and causes different configuration cannot be applied in different proxy.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="abc"
transports="http"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<target>
<inSequence>
<log level="full"/>
<property name="address"
scope="transport"
expression="fn:substring-after(get-property('To'),'/services/crownperth')"/>
<class name="com.abc.customerintegration.mediator.CustomerInfoMediator">
<property name="pmServerAddress" value="http://192.168.112.243:3509/MobileConnectService"></property>
<property name="property" value="P"/>
<property name="languageCode" value="en-US"></property>
</class>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="def"
transports="http"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<target>
<inSequence>
<log level="full"/>
<property name="address"
scope="transport"
expression="fn:substring-after(get-property('To'),'/services/crownperth')"/>
<class name="com.abc.customerintegration.mediator.CustomerInfoMediator">
<property name="pmServerAddress" value="http://192.168.112.243:3509/MobileConnectService"></property>
<property name="property" value="P"/>
<property name="languageCode" value="en-US"></property>
</class>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>