I am getting an error whenever I tried to redeploy the app to the esb. I am trying to merge the 2 response from different api and then map and manipulate that response. I am also using the latest 5.0.0 BETA version both esb tooling and esb.
Here is the fault reason
org.apache.axis2.deployment.DeploymentException: API deployment from
the file :
/Users/me/Downloads/wso2esb-5.0.0-BETA2/tmp/carbonapps/-1234/1468999438631movieapiApp_1.0.0.car/movieAPI_1.0.0/movieAPI-1.0.0.xml
: Failed. at
org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.deploy(AbstractSynapseArtifactDeployer.java:213)
at
org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.deployArtifacts(SynapseAppDeployer.java:131)
at
org.wso2.carbon.application.deployer.internal.ApplicationManager.deployCarbonApp(ApplicationManager.java:263)
at
org.wso2.carbon.application.deployer.CappAxis2Deployer.deploy(CappAxis2Deployer.java:72)
at
org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
at
org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at
org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at
org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at
org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at
org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
at
org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
at
org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:93)
at
org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:138)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
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) Caused by:
org.apache.axis2.deployment.DeploymentException: API deployment from
the file :
/Users/me/Downloads/wso2esb-5.0.0-BETA2/tmp/carbonapps/-1234/1468999438631movieapiApp_1.0.0.car/movieAPI_1.0.0/movieAPI-1.0.0.xml
: Failed. at
org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.deploy(AbstractSynapseArtifactDeployer.java:201)
... 20 more Caused by:
org.apache.synapse.deployers.SynapseArtifactDeploymentException: API
deployment from the file :
/Users/me/Downloads/wso2esb-5.0.0-BETA2/tmp/carbonapps/-1234/1468999438631movieapiApp_1.0.0.car/movieAPI_1.0.0/movieAPI-1.0.0.xml
: Failed. at
org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.handleSynapseArtifactDeploymentError(AbstractSynapseArtifactDeployer.java:474)
at
org.apache.synapse.deployers.APIDeployer.deploySynapseArtifact(APIDeployer.java:71)
at
org.wso2.carbon.rest.api.ApiDeployer.deploySynapseArtifact(ApiDeployer.java:34)
at
org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.deploy(AbstractSynapseArtifactDeployer.java:194)
... 20 more Caused by: org.apache.synapse.SynapseException: Duplicate
resource definition by the name: movieapi at
org.apache.synapse.config.SynapseConfiguration.handleException(SynapseConfiguration.java:1627)
at
org.apache.synapse.config.SynapseConfiguration.addAPI(SynapseConfiguration.java:414)
at
org.apache.synapse.deployers.APIDeployer.deploySynapseArtifact(APIDeployer.java:59)
... 22 more
and here's my api
<?xml version="1.0" encoding="UTF-8"?>
<api context="/movieapi" name="movieapi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/*">
<inSequence>
<property name="ROOT" scope="default">
<root:movie xmlns:root="www.wso2esb.com"/>
</property>
<log level="full"/>
<clone continueParent="true" id="movie" sequential="true">
<target>
<sequence>
<send>
<endpoint>
<address format="rest" uri="https://api.themoviedb.org/3/movie/tt0918940?api_key=code&append_to_response=casts,images%22"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<send>
<endpoint>
<address format="rest" uri="https://www.omdbapi.com/?type=movie&i=tt0918940"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<aggregate id="movie">
<completeCondition>
<messageCount max="-1" min="-1"/>
</completeCondition>
<onComplete enclosingElementProperty="ROOT" expression="//jsonObject" xmlns:dummy="http://org.dummy" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<datamapper config="gov:datamapper/movieapiMapping.dmc" inputSchema="gov:datamapper/movieapiMapping_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/movieapiMapping_outputSchema.json" outputType="JSON"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<respond/>
</onComplete>
</aggregate>
</outSequence>
<faultSequence/>
</resource>
</api>
and this is from the terminal
[2016-07-20 15:36:48,890] ERROR - DataMapperMediator DataMapper mediator : mapping configuration is null
The error you are getting in the terminal DataMapperMediator DataMapper mediator : mapping configuration is null is because the relevant registry resources are not deployed (more precisely, the configuration .dmc file). When you are deploying the capp, make sure that all the registry resources are included as well. Also when the capp deployment fails, can you check in the management console for any faulty services/APIs?
You get the error indicating Data mapper configurations null. So you have to add relevant configurations as you given in the proxy:
<datamapper config="gov:datamapper/movieapiMapping.dmc" inputSchema="gov:datamapper/movieapiMapping_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/movieapiMapping_outputSchema.json" outputType="JSON"/>
For example: You indicated about gov:datamapper/movieapiMapping.dmc
This should be available in governance registry.Please deploy relevant configs in to ESB.
Open the pom.xml file inside your CompositeApplication.
Edit it in the Design mode.
Under dependencies, you can see the artifacts which you can include.
Tick the checkbox near your relevant Registry artifact. Save pom file.
Now redeploy the application to the server or Regenerate your car file
Related
We have on premise WSO2 stack for managing the api subscription where there are client applications created in the wso2 store URL for generating access tokens. One of the development team in our organization is trying to generate the access token from the client id and secret by the means of javascript. The tokens are not getting generated and resulting into CORS issue. I have checked the documentations for similar issues and I have made change in the TokenAPI.xml file located under the <API_M>/repository/deployment/server/synapse-configs/default/api directory by adding the outsequence property. Unfortunately this did not solve the issue. I have read a few documentations and verified the cors configuration in the api manager.xml file it looked fine to me.
const token =
"Base64(consumer-key:consumer-secret)";
const url = "https://<gateway_Url>/token";
const res = axios({
method: "post",
url: url,
data: "grant_type=client_credentials",
headers: {
"Authorization": `Basic ${token}`,
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json"
},
});
cat /data/wso2/wso2am-2.6.0/repository/deployment/server/synapse-configs/default/api/_TokenAPI_.xml
<api xmlns="http://ws.apache.org/ns/synapse" name="_WSO2AMTokenAPI_" context="/token">
<resource methods="POST" url-mapping="/*" faultSequence="_token_fault_">
<inSequence>
<property name="uri.var.portnum" expression="get-property('keyManager.port')"/>
<property name="uri.var.hostname" expression="get-property('keyManager.hostname')"/>
<send>
<endpoint>
<http uri-template="https://{uri.var.hostname}:{uri.var.portnum}/oauth2/token">
<timeout>
<duration>60000</duration>
<responseAction>fault</responseAction>
</timeout>
</http>
</endpoint>
</send>
</inSequence>
<outSequence>
<property name="Access-Control-Allow-Headers" scope="transport" value="authorization,Access-Control-Allow-Origin,Content-Type,Action"></property>
<send/>
</outSequence>
</resource>
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerCacheExtensionHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.common.SynapsePropertiesHandler"/>
</handlers>
</api>
Error - Access to XMLHttpRequest at 'https://api-uat.ucl.ac.uk/token' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
You might have to add the CORS handler to the token API under handlers.
<handler class= "org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
<property name="apiImplementationType" value="ENDPOINT"/>
</handler>
I have a data service exposed as a REST resource that inserts data into a MySQL table. When I call this resource directly from postman, it inserts the data successfully. However, when I call it via an endpoint it gives the following error:
ERROR {DBInOnlyMessageReceiver} - Error in in-only message receiver DS Fault Message: Error in DS non result invoke.
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description:
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}
at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:117)
at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:66)
at org.wso2.micro.integrator.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:358)
at org.wso2.micro.integrator.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:40)
at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:52)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:375)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:189)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description:
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:100)
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:105)
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:78)
at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:115)
... 12 more
Caused by: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description:
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}
at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:337)
at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:278)
at org.wso2.micro.integrator.dataservices.core.engine.OutputElement.execute(OutputElement.java:88)
at org.wso2.micro.integrator.dataservices.core.description.resource.Resource.execute(Resource.java:66)
at org.wso2.micro.integrator.dataservices.core.engine.DataService.invoke(DataService.java:613)
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:94)
... 15 more
[2022-07-14 11:13:54,166] ERROR {ServerWorker} - Error processing GET request for : /services/CustomerDataService.HTTPEndpoint/customer/John org.apache.axis2.AxisFault: DS Fault Message: Error in DS non result invoke.
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description:
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}
at org.wso2.micro.integrator.dataservices.core.DBUtils.createAxisFault(DBUtils.java:814)
at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:57)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:375)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:189)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description:
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:100)
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:105)
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:78)
at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:115)
at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:66)
at org.wso2.micro.integrator.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:358)
at org.wso2.micro.integrator.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:40)
at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:52)
... 8 more
Caused by: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description:
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}
at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:337)
at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:278)
at org.wso2.micro.integrator.dataservices.core.engine.OutputElement.execute(OutputElement.java:88)
at org.wso2.micro.integrator.dataservices.core.description.resource.Resource.execute(Resource.java:66)
at org.wso2.micro.integrator.dataservices.core.engine.DataService.invoke(DataService.java:613)
at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:94)
... 15 more
The endpoint that calls the data service REST resource:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="CreateCustomerInDB" xmlns="http://ws.apache.org/ns/synapse">
<http method="get" uri-template="http://localhost:8290/services/CustomerDataService.HTTPEndpoint/customer/{uri.var.firstName}">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
The data service:
<data name="CustomerDataService" serviceNamespace="" serviceGroup="" transports="">
<description />
<config id="CustomerDatasource">
<property name="driverClassName">com.mysql.cj.jdbc.Driver</property>
<property name="url">jdbc:mysql://localhost:3306/demopresentation</property>
<property name="username">root</property>
<property name="password" />
</config>
<query id="CreateCustomerEntry" useConfig="CustomerDatasource">
<sql>insert into customers (FirstName) values (:firstName)</sql>
<param name="firstName" paramType="SCALAR" sqlType="STRING" type="IN" />
</query>
<resource path="customer/{firstName}" method="GET">
<call-query href="CreateCustomerEntry" >
<with-param name="firstName" query-param="firstName" />
</call-query>
</resource>
</data>
Point of entry into integration that then calls the above code:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/person" name="PersonAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST GET" uri-template="/customer">
<inSequence>
<log description="Full incoming msg log" level="full" separator=" >>> "/>
<propertyGroup>
<property expression="json-eval($.name.first_name)" name="uri.var.firstName" scope="default" type="STRING"/>
<property expression="json-eval($.name.last_name)" name="uri.var.lastName" scope="default" type="STRING"/>
<property expression="json-eval($.date_of_birth)" name="uri.var.dob" scope="default" type="STRING"/>
<property expression="json-eval($.email)" name="uri.var.email" scope="default" type="STRING"/>
<property name="TEST" scope="default" type="STRING" value="TEST_VALUE"/>
</propertyGroup>
<log level="custom">
<property expression="get-property('uri.var.firstName')" name="FName"/>
<property expression="get-property('uri.var.lastName')" name="LName"/>
<property expression="get-property('uri.var.dob')" name="DOB"/>
<property expression="get-property('uri.var.email')" name="Email"/>
<property expression="get-property('TEST')" name="TESTVAR"/>
</log>
<call>
<endpoint key="CreateCustomerInDB"/>
</call>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
first of all it is a very bad idea to use GET for inserting data into database. Just don't do that in that way - the practice does not follow the restfull rules.
And the problem looks like you don't pass uri.var.firstName parameter to your endpoint. Question is - how you call this endpoint? Do you have set the:uri.var.firstName, before call endpoint for example:
<property value="TestName" name="uri.var.firstName" scope="default" type="STRING"/>
Update:
For sending JSON data in POST request to DataService you can follow that documentation: Data i JSON format
It is important to have proper JSON data structure for that post.
Working with Integration Studio in Windows 10.
When I try Validate my Payload from REST API body with Sequence with Validate Mediator I get an Error.
Error:
[2020-03-10 11:07:29,295] INFO {TRACE_LOGGER} - Building message. Sequence <SequenceMediator> is content aware
[2020-03-10 11:07:29,309] ERROR {org.apache.synapse.mediators.base.SequenceMediator} - Unsupported Operation org.apache.axiom.om.OMException: Unsupported Operation
at org.apache.axiom.om.impl.llom.OMTextImpl.getInputStream(OMTextImpl.java:422)
at org.apache.synapse.mediators.builtin.ValidateMediator.mediate(ValidateMediator.java:231)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:214)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:37)
at org.apache.synapse.config.xml.SwitchCase.mediate(SwitchCase.java:69)
at org.apache.synapse.mediators.filters.SwitchMediator.mediate(SwitchMediator.java:134)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:331)
at org.apache.synapse.rest.API.process(API.java:440)
at org.apache.synapse.rest.RESTRequestHandler.apiProcessNonDefaultStrategy(RESTRequestHandler.java:149)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:95)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:71)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:325)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:98)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:367)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:412)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:181)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Then I try to validate from it:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="Reserves" statistics="enable" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<validate cache-schema="false" source="json-eval($)">
<schema key="conf:/schemas/ReservesRoot.json"/>
<on-fail>
<payloadFactory media-type="json">
<format>{"Error":$1"}</format>
<args>
<arg evaluator="xml" expression="$ctx:ERROR_MESSAGE"/>
</args>
</payloadFactory>
<property name="HTTP_SC" scope="axis2" type="STRING" value="500"/>
<respond/>
</on-fail>
</validate>
</sequence>
JSON Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"Type": {
"type": "string"
}
},
"required": [
"Type"
]
}
When I get the schema in property I see the schema's string.
<property value="get-property('registry', 'conf:/schemas/ReservesRoot.json')" name="ReservesSchema"/>
<log>
<property expression="get-property('ReservesSchema')" name="JSON_P"/>
</log>
This issue occurs when the JSON-schema saved in the registry does not have the correct media-type (must be application/json). Could you please double-check this in Integration studio Resources Editor view.
You can access the resources editor view by right click on registry resource project -> Registry resource editor
This issue occurs with Micro integrator. Micro integrator does not have rdbms registry artifacts. Hence we cannot specify the media type. The work around is to add local entry file with the validation json schema and refer it in synapse.
<validate cache-schema="false">
<schema key="createotpvalidate"/>
<on-fail>
<payloadFactory media-type="json">
<format>{"Error":$1"}</format>
<args>
<arg evaluator="xml" expression="$ctx:ERROR_MESSAGE"/>
</args>
</payloadFactory>
<property name="HTTP_SC" scope="axis2" type="STRING" value="500"/>
<respond/>
<!-- <schema key="conf:/schema/CreateOTPSchema.json"/> -->
</on-fail>
</validate>
Local Entry file:
<?xml version="1.0" encoding="UTF-8"?>
<localEntry key="createotpvalidate" xmlns="http://ws.apache.org/ns/synapse"><![CDATA[{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "request_type": { "type": "string" },"mobile": { "type": "string" },"otp": { "type": "string" } }, "required": [ "request_type","mobile","otp" ] }]]></localEntry>
I have a data service that contains two queries. One is a select query and the other is an insert query.
How could we call both queries in a single proxy service? Is there any way to call both queries in a single operation or by adding two call mediators in the proxy service?
As I am using call mediator, how can we call different operations? I have tried it by creating two different data services, but it is giving error "Error while building Passthrough stream"
Can any one provide a sample of both?
Source of my Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EslSfaOfaCreateSaleOrdersPS"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<call>
<endpoint>
<address format="soap11"
uri="http://10.1.6.175:9763/services/EslSfaExtractSODataService.SOAP11Endpoint/"/>
</endpoint>
</call>
<call>
<endpoint>
<address format="soap11"
uri="http://10.1.6.175:9763/services/EslSfaInsertTempDataService.SOAP11Endpoint/"/>
</endpoint>
</call>
<log level="full"/>
<datamapper config="gov:datamapper/EslSfaOfaCreateSOMapping.dmc"
inputSchema="gov:datamapper/EslSfaOfaCreateSOMapping_inputSchema.json"
inputType="XML"
outputSchema="gov:datamapper/EslSfaOfaCreateSOMapping_outputSchema.json"
outputType="XML"/>
<log level="full"/>
<header/>
<call>
<endpoint>
<address format="soap11"
uri="https://host/soa-infra/services/default/DooDecompReceiveOrderExternalComposite/ReceiveOrderRequestService"/>
</endpoint>
</call>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<description/>
</proxy>
The error start coming as i aded second call
TID: [-1234] [] [2017-02-25 15:08:36,060] ERROR {org.apache.synapse.transport.passthru.util.RelayUtils} - Error while building Passthrough stream {org.apache.synapse.transport.passthru.util.RelayUtils}
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found faultstring
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:65)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:148)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:137)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:100)
at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:140)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:260)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:766)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:261)
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)
TID: [-1234] [] [2017-02-25 15:08:36,065] ERROR {org.apache.synapse.mediators.base.SequenceMediator} - Error while building message {org.apache.synapse.mediators.base.SequenceMediator}
org.apache.axis2.AxisFault: Error while building Passthrough stream
at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:284)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:143)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:100)
at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:140)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:260)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:766)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
When I send a request to axis2 client I get a error
Proxy:
<proxy name="SOAP_Body" startOnLoad="true">
<target>
<inSequence>
<switch xmlns:m0="http://services.samples"
source="//m0:getQuote/m0:request/m0:symbol">
<case regex="foo">
<log level="custom">
<property name="a" value="s"/>
</log>
<send>
<endpoint>
<address uri="http://localhost:9001/services/SimpleStockQuoteService?wsdl"/>
</endpoint>
</send>
</case>
<case regex="bar">
<log level="custom">
<property name="b" value="a"/>
</log>
<send>
<endpoint>
<address uri="http://localhost:9002/services/SimpleStockQuoteService?wsdl"/>
</endpoint>
</send>
</case>
<default>
<property name="symbol"
expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"/>
</default>
</switch>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
ELB in 9443 offset 0, ESB in 9444 offset 1
so I have sent a request to http://localhost:8280/services/SOAP_Body of ELB
and I get the following error when I have sent a request thru axis2client in esb
[java] 15/06/30 15:40:43 INFO httpclient.HttpMethodDirector: I/O exception
(java.net.ConnectException) caught when processing request: Connection refused:
connect
When I send through SOAP UI for the above endpoint I get
Wed Jul 01 10:48:06 IST 2015:ERROR:Exception in request: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8280 refused
Wed Jul 01 10:48:06 IST 2015:ERROR:An error occured [Connection to http://localhost:8280 refused], see error log for details
Wed Jul 01 10:48:06 IST 2015:INFO:Error getting response for [SimpleStockQuoteServiceSoap11Binding.getQuote:Request 1]; org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8280 refused
I have enabled clustering and other configuration as in 1
But when I send request to ESB alone without getting through ELB I get the desired output.
When I give AllowAll in axis2.xml in ELB i get the new error in ELB server
Error - DynamicLoadbalanceEndpoint application member not available
What would be the problem? Please help me out.
Did any of you got sample 57 in wso2 esb for dynamic endpoint working? If yes please help me in configuring. I have configured as in documentation but i couldnt get it working.
Thanks.
There is not enough information in your question.
Post the full stack trace.
Where is your axis 2 service being hosted? WSO2AS?
What is your axis 2 service endpoint.
Post your send mediator xml config.
Have you checked whether the endpoint is working correctly...
Please try this on the web browser:
http://localhost:8280/services/SOAP_Body?wsdl
and see whether or not you get the wsdl of the proxy.