I want to have a try with the new "registry" scope in ESB 4.9.0, but when I set up a simple proxy with the provided example in property mediator documentation, it cannot be saved and reports an error.
TID: [-1234] [] [2015-09-24 15:30:21,085] ERROR {org.wso2.carbon.proxyadmin.service.ProxyServiceAdmin} - Unable to save changes made for the proxy service : test_property. Restored the existing proxy... :: Only 'axis2' or 'transport' or 'axis2-client' or 'default' or 'operation' values are allowed for attribute scope for a property mediator, Unsupported scope registry {org.wso2.carbon.proxyadmin.service.ProxyServiceAdmin}
org.apache.synapse.SynapseException: Only 'axis2' or 'transport' or 'axis2-client' or 'default' or 'operation' values are allowed for attribute scope for a property mediator, Unsupported scope registry
Here is the proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="test_property"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="conf:/Resource/foo" value="Sample Property Content" scope="registry"/>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
I am not sure if I need to set up some configuration first? I downloaded a new esb 4.9.0 package, and run separately. Thanks in advance!
You can retrieve properties from within the registry by using the registry scope.
<property name="fromRegistryToDefault" expression="get-property('registry','registryPath#propertyName')"/>
Documentation of retrieving properties from registry
But I don't think you can store new properties into the registry store directly from a Proxy inSequence. Do you have any documentation about that?
Version 4.9 does not allow this value for the scope of a property mediator.
Download the ESB 5.0.0 and you will see that your proxy works perfectly.
You can store in "registry" scope in this version.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="test_property"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<property name="conf:/Resource/foo"
scope="registry"
type="STRING"
value="Sample Property Content"/>
<log level="full"/>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
Related
Scenario
I'm using Wso2 Email Connector for sending emails to our company's smtp server. Following is the code for connection and Api
Connection
<?xml version="1.0" encoding="UTF-8"?>
<localEntry key="techlogixSmtp" xmlns="http://ws.apache.org/ns/synapse">
<email.init>
<connectionType>SMTPS</connectionType>
<password>xxxx</password>
<host>smtp.techlogix.com</host>
<requireTLS>true</requireTLS>
<port>25</port>
<name>techlogixSmtp</name>
<username>xxxx</username>
</email.init>
</localEntry>
Api
<?xml version="1.0" encoding="UTF-8"?>
<api context="/email" name="EmailMicroService" port="8290" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/send">
<inSequence>
<log level="full"/>
<email.send configKey="techlogixSmtp">
<from>{json-eval($.from)}</from>
<to>{json-eval($.to)}</to>
<subject>{json-eval($.subject)}</subject>
<content>{json-eval($.content)}</content>
<contentType>{json-eval($.contentType)}</contentType>
<attachments>{json-eval($.attachments)}</attachments>
</email.send>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Question
I'm facing the ERROR {InvokeMediator} - {api:EmailMicroService} Sequence named Value {name ='null', keyValue ='techlogixSmtp'} cannot be found. What possible configuration is missing from my end which is causing this issue?
I made sure that updated Api is deployed on MicroIntegrator
As Sanoj, mentioned your Local Entry techlogixSmtp seems not deployed to the Runtime. So in your CompositeExporter Project make sure your techlogixSmtp is checked and the correct Server Role is selected. Please refer to the following image.
When i tried to use the data mapper mediator I always get an error. I tried mapping the json response to xml.
[2016-07-14 14:05:26,684] ERROR - omdbapi DataMapper mediator : mapping failed
XML not well-formed. Error occurred while processing start element event
at org.wso2.carbon.mediator.datamapper.engine.input.readers.XMLReader.read(XMLReader.java:97)
at org.wso2.carbon.mediator.datamapper.engine.input.InputModelBuilder.buildInputModel(InputModelBuilder.java:52)
at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:59)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:244)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:209)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:49)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:160)
at org.apache.synapse.rest.Resource.process(Resource.java:320)
at org.apache.synapse.rest.API.process(API.java:336)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:120)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:100)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:55)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:541)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:179)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:252)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Here is my api. I just use the omdbapi to give an example.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/omdbapi" name="omdbapi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/*">
<inSequence>
<send>
<endpoint>
<address trace="disable" uri="http://www.omdbapi.com/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<datamapper config="gov:datamapper/omdbapiConfig.dmc" inputSchema="gov:datamapper/omdbapiConfig_inputSchema.json" inputType="XML" outputSchema="gov:datamapper/omdbapiConfig_outputSchema.json" outputType="XML"/>
<respond/>
</outSequence>
<faultSequence/>
</resource>
</api>
If you are trying to map JSON-> XML, you need to specify in the Data Mapper Mediator configuration.
Make sure you set the input type as JSON.
And there have been beta2 release on wso2 esb. So try using beta2 packs for esb runtime and tooling. Use the latest pack and try.
I am going to concat input file name with SYSTEM_DATE below is the code
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="importclassroomcourse"
transports="https,http,local"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="custom">
<property name="transport.vfs.ReplyFileName"
expression="fn:concat(get-property('SYSTEM_DATE', 'yyMMddHHmmss'), '-', get-property('filename'), '.xml')"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="https://qa-abc.com/api/classroom/xyz"/>
</endpoint>
</target>
<description/>
</proxy>
But it won't concat the file name below is the log
LogMediator transport.vfs.ReplyFileName = 160316122250-.xml
Kindly guide me how can i get the file name because file name is missing.I have sent the file test.xlsx
I can't find any initialisation of property 'filename' in your mediation : this property does not exist and therefore, has no value when used in 'concat'.
What do you mean by "I have sent the file text.xlsx" ? Your proxy use http and local transport, it's not a VFS proxy scanning a directory to load files ?
You can define this property :
<property name="transport.vfs.ReplyFileName" expression="fn:concat(get-property('SYSTEM_DATE', 'yyMMddHHmmss'), '-test.xml')"/>
but after that, you must use send with a vfs endpoint inside the inSequence to write the file (in your case, there is a https endpoint)
If your proxy were a VFS proxy, you could use FILE_NAME on scope transport to get incoming filename.
When I implement the scenario at http://wso2.com/library/tutorials/2013/12/lightweight-service-orchestration-for-non-blocking-backend-services-using-wso2-esb/ I get an error that says
"Proxy Service requires a valid in sequence or valid endpoint".
is there something I am missing from this demo? It seems straightforward enough. I have the latest ESB software as of today if that makes a difference. It is higher than 4.5 as the article says.
There is an error in this sample, proxy xml definition must be outside description tag :
<proxy xmlns="http://ws.apache.org/ns/synapse" name="studentRegistrationProxy" transports="https http" startonload="true" trace="disable">
<description></description>
<target>
<insequence>
<clone>
...
</clone>
</insequence>
<outsequence>
<aggregate>
...
</aggregate>
</outsequence>
<faultsequence>
</faultsequence>
</target>
</proxy>
When activating a proxy (with the Web UI), I always get following error message:
WARNING: EPRs are NULL. Transport configuration may be incorrect
But I just don't understand why and what it means?
The source of the proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="patient_toMPI_pJMS_qPatientToMPI" statistics="disable" trace="disable" transports="jms">
<parameter name="transport.jms.Destination">patient_qPatientToMPI</parameter>
<parameter name="transport.jms.ConnectionFactory">queueNonBlocking</parameter>
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<target faultSequence="errorSequence">
<inSequence>
<log level="custom">
<property name="Patient/toMPI" value="proxy (patient_toMPI_pJMS_qPatientToMPI) called"/>
</log>
<sequence key="patient_toMPI_sTransform"/>
</inSequence>
</target>
</proxy>
Simple fix :) Simply go to "Edit Data Service" and tick http and https on "Transport Settings"
This has already been reported as a bug here. It will be resolved in future releases.
Are you logged in as the super tenant? If so you should not be getting this issue. Aforementioned bug, we experienced only in tenant-mode.
Please make sure, you have copied required (correct) client libraries into repository/components/lib directory in ESB to allow connection between the ESB and the JMS provider.
For eg: If the provider is active-mq, you need to copy following jar files.
activemq-core-xxx.jar AND geronimo-j2ee-management_xx_spec-xx.jar