we have three querys, one select and two insert queries.
We have to execute the select query and it returns a row with four fields.
Then we have to use these four fields to excute the inserts querys.
Select query works fine, but when WSO2 ESB try to execute the next nested query fails, and show the next error
Unable to sendViaPost to url[http://6f478fba7fca:8280/services/...........SOAP12Endpoint] {org.apache.axis2.transport.http.HTTPSender
This is the xml about our data service.
<query id="updateASMCRRN" useConfig="DATABASE1_PRE">
<sql>UPDATE BOSA_ASMCRRCN SET RT_COD=:RT_COD, SET RT_DATE_DAT=to_date(:RT_DATE_DAT,'YYYY-MM-DD HH:MI:SS'), WHERE SUMMON_COD=:SUMMON_COD AND SUMREQ_SEQTMP=:SUMREQ_SEQTMP</sql>
<param name="RT_COD" sqlType="STRING"/>
<param name="RT_DATE_DAT" sqlType="STRING"/>
<param name="SUMMON_COD" sqlType="STRING"/>
<param name="SUMREQ_SEQTMP" sqlType="INTEGER"/>
</query>
......
<query id="selectNewSol" useConfig="DATABASE2_PRE">
<sql>SELECT s.NUMEROREGISTRO, to_char(s.FECHA,'YYYY-MM-DD HH:MI:SS') AS FECHA, v1.C_CLAVE_ID, v1.A_VALOR AS SUMMON_COD, v2.C_CLAVE_ID, v2.A_VALOR AS SUMREQ_SEQTMP FROM adel.ae_solicitudes s, adel.ae_valores v1, adel.ae_valores v2 WHERE s.CODFORMULARIO='1057' AND s.B_PROCESADA=1 AND s.NUMEROREGISTRO = v1.NUMEROREGISTRO AND v1.C_CLAVE_ID='.SUMMON_COD' AND s.NUMEROREGISTRO = v2.NUMEROREGISTRO AND v2.C_CLAVE_ID='.SUMREQ_SEQTMP'</sql>
<sql dialect="oracle">SELECT s.NUMEROREGISTRO, to_char(s.FECHA,'YYYY-MM-DD HH:MI:SS') AS FECHA, v1.C_CLAVE_ID, v1.A_VALOR AS SUMMON_COD, v2.C_CLAVE_ID, v2.A_VALOR AS SUMREQ_SEQTMP FROM adel.ae_solicitudes s, adel.ae_valores v1, adel.ae_valores v2 WHERE s.CODFORMULARIO='1057' AND s.B_PROCESADA=1 AND s.NUMEROREGISTRO = v1.NUMEROREGISTRO AND v1.C_CLAVE_ID='.SUMMON_COD' AND s.NUMEROREGISTRO = v2.NUMEROREGISTRO AND v2.C_CLAVE_ID='.SUMREQ_SEQTMP'</sql>
<result element="Solicitudes" rowName="Solicitud">
<element export="SUMMON_COD" name="SUMMON_COD" query-param="SUMMON_COD" xsdType="string"/>
<element export="RT_COD" name="RT_COD" query-param="NUMEROREGISTRO" xsdType="string"/>
<element export="RT_DATE_DAT" name="RT_DATE_DAT" query-param="FECHA" xsdType="string"/>
<element export="SUMREQ_SEQTMP" name="SUMREQ_SEQTMP" query-param="SUMREQ_SEQTMP" xsdType="integer"/>
<call-query href="updateASMCRRN">
<with-param name="RT_COD" query-param="NUMEROREGISTRO"/>
<with-param name="RT_DATE_DAT" query-param="FECHA"/>
<with-param name="SUMMON_COD" query-param="SUMMON_COD"/>
<with-param name="SUMREQ_SEQTMP" query-param="SUMREQ_SEQTMP"/>
</call-query>
</result>
</query>
<operation name="selectNewSol">
<call-query href="selectNewSol"/>
</operation>
Now this is the error:
ERROR {org.apache.synapse.transport.passthru.PassThroughHttpSender} - Failed to submit the response {org.apache.synapse.transport.passthru.PassThroughHttpSender}
org.apache.axis2.AxisFault: DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': operation not allowed
DS Code: DATABASE_ERROR
Nested Exception:-
java.sql.SQLException: operation not allowed
DS Code: DATABASE_ERROR
Source Data Service:-
Name: pollingSolicitudesADEL
Location: /pollingSolicitudesADEL.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: selectNewSol
Current Params: {}
Nested Exception:-
DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': operation not allowed
DS Code: DATABASE_ERROR
Nested Exception:-
java.sql.SQLException: operation not allowed
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo
Thanks in advance for any help.
Related
I've trying to create a simple data service that inserts an entry in our database with the following definition:
<data name="RESTLoggerDataService" serviceNamespace="" transports="http https">
<config id="default">
<property name="driverClassName">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="url">jdbc:sqlserver://SERVER:1433;databaseName=DB</property>
<property name="username">user</property>
<property name="password">pass</property>
</config>
<query id="CreateLog" useConfig="default">
<sql>INSERT INTO Log (Date, Username, ServiceID) VALUES (?,?,?)</sql>
<param name="Date" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="1"/>
<param name="Username" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="2"/>
<param name="ServiceID" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="3"/>
</query>
<resource method="POST" path="Log">
<call-query href="CreateLog">
<with-param name="Date" query-param="Date"/>
<with-param name="Username" query-param="Username"/>
<with-param name="ServiceID" query-param="ServiceID"/>
</call-query>
</resource>
</data>
It seems this is not quite valid as none of the parameters I'm passing in via a CURL call are binding. I've tried:
curl -X POST -H 'Accept: application/xml' -H 'Content-Type: application/xml' --data "#test.xml" http://localhost:90/services/RESTLoggerDataService/Log
with the following XML:
<_postlog>
<Date>2020-09-15 09:06:00.000</Date>
<Username>KIRBJJ</Username>
<ServiceID>WA233</ServiceID>
</_postlog>
but get the following back:
curl: (52) Empty reply from server
curl: (52) Empty reply from server
<axis2ns19:DataServiceFault xmlns:axis2ns19="http://ws.wso2.org/dataservice"><axis2ns19:current_params>{Username=null, Date=null, ServiceID=null}</axis2ns19:current_params><axis2ns19:source_data_service><axis2ns19:data_service_name>RESTLoggerDataService</axis2ns19:data_service_name><axis2ns19:description>Exposing the data service as a REST service.</axis2ns19:description><axis2ns19:location>C:\PROGRA~1\WSO2\ENTERP~1\7154FB~1.0\MICRO-~1\bin\..\tmp\carbonapps\-1234\1600259919991RestLoggerCompositeExporter_1.0.0.car\RESTDataService_1.0.0\RESTDataService-1.0.0.dbs</axis2ns19:location><axis2ns19:default_namespace>http://ws.wso2.org/dataservice</axis2ns19:default_namespace></axis2ns19:source_data_service><axis2ns19:ds_code>DATABASE_ERROR</axis2ns19:ds_code><axis2ns19:nested_exception>com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'Date', table 'LOGS.dbo.LogEntry'; column does not allow nulls. INSERT fails.</axis2ns19:nested_exception><axis2ns19:current_request_name>_postlog</axis2ns19:current_request_name></axis2ns19:DataServiceFault>
<axis2ns8:DataServiceFault xmlns:axis2ns8="http://ws.wso2.org/dataservice">
<axis2ns8:current_params>{}</axis2ns8:current_params>
<axis2ns8:source_data_service>
<axis2ns8:data_service_name>RESTLoggerDataService</axis2ns8:data_service_name>
<axis2ns8:description>Exposing the data service as a REST service.</axis2ns8:description>
<axis2ns8:location>C:\PROGRA~1\WSO2\ENTERP~1\7154FB~1.0\MICRO-~1\bin\..\tmp\carbonapps\-1234\1600263784524RestLoggerCompositeExporter_1.0.0.car\RESTDataService_1.0.0\RESTDataService-1.0.0.dbs</axis2ns8:location>
<axis2ns8:default_namespace>http://ws.wso2.org/dataservice/LoggingAPI</axis2ns8:default_namespace>
</axis2ns8:source_data_service>
<axis2ns8:ds_code>INCOMPATIBLE_PARAMETERS_ERROR</axis2ns8:ds_code>
<axis2ns8:current_request_name>_postlog</axis2ns8:current_request_name>
</axis2ns8:DataServiceFault>
It appears the input parameters are not binding correctly. Can anybody see what I'm doing wrong?
I have created a similar data service with MySQL and did not face any issues. Could you please try the following and see if it makes any changes. Change the payload by adding namespaces as follows and try the same mediation.
<p:_postlog xmlns:p="http://ws.wso2.org/dataservice">
<xs:Date xmlns:xs="http://ws.wso2.org/dataservice">2020-09-15 09:06:00.000</xs:Date>
<xs:Username xmlns:xs="http://ws.wso2.org/dataservice">KIRBJJ</xs:Username>
<xs:ServiceID xmlns:xs="http://ws.wso2.org/dataservice">WA233</xs:ServiceID>
</p:_postlog>
If this does not work please enable wire logs and confirm that the correct payload is passed to the data service.
I am using WSO2 EI 6.3.0 version. I am creating data service within the application which reads data from CSV.
I am running into very unusual case where I have created two data services. One with sample Product.csv which is shipped with WSO2 EI.
When calling Sample (Product.CSV) I am able to get the json response message. but when I am trying to invoke another API which other data service it is giving me below error:
[2018-10-10 17:57:31,916] [EI-Core] ERROR - JsonStreamFormatter Error occurred while writing to application/json
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.wso2.carbon.integrator.core.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:107)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:597)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:281)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
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:337)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:158)
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 CSVQuery.runQuery.
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: InvoiceReport
Location: /InvoiceReport.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getinvoice
Current Params: {}
Nested Exception:-
DS Fault Message: Error in 'StaticOutputElement.execute', cannot find parameter with type:column name:Docnumber
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Below is Data service:
<data name="InvoiceReport" transports="http https local">
<config enableOData="false" id="CSV_InvoiceReport">
<property name="csv_datasource">/usr/lib/wso2/wso2ei/6.3.0/samples/data-services/resources/Invoice.csv</property>
<property name="csv_columnseperator">comma</property>
<property name="csv_startingrow">2</property>
<property name="csv_hasheader">true</property>
<property name="csv_headerrow">1</property>
</config>
<query id="Q2" useConfig="CSV_InvoiceReport">
<result outputType="json">{
"Products": {
"Product": [
{
"Docnumber":"$Docnumber",
"Invoicenumber":"$Invoicenumber",
"Documentdate":"$Documentdate",
"Invoiceduedate":"$Invoiceduedate",
"Customerid":"$Customerid",
"Documenttotal":"$Documenttotal",
"Quantity":"$Quantity",
"Unitprice":"$Unitprice",
"Extendedprice":"$Extendedprice",
"Consumer":"$Consumer",
"Servicename":"$Servicename"
}
]
}
}
</result>
</query>
<operation name="GetInvoiceReport">
<call-query href="Q2"/>
</operation>
<resource method="GET" path="Invoice">
<call-query href="Q2"/>
</resource>
</data>
Not sure where is the problem. Both are simple data service and didnot find any differences in creating them. One is working and one is not working at all.
Can some one please help me. Is this a bug?
Thanks in advance.
I'm trying to call a web service exposed by third party. After receiving the response I'm wrapping the response to the appropriate class. While marshalling the object of the wrapper class to xml string using "jaxb" I'm getting the error as:
org.apache.camel.NoTypeConversionAvailableException: No type converter
available to convert from type:
com.unifyv4.ws.CreateOrganisationResponse to the required type:
java.io.InputStream with value
com.unifyv4.ws.CreateOrganisationResponse#312ea56e
Detailed Stack Trace:
n | BodyType com.unifyv4.ws.CreateOrganisationResponse
n | Body
com.unifyv4.ws.CreateOrganisationResponse#2c9a5080
n | ]n | n | Stacktracen |
java.io.IOException:
org.apache.camel.NoTypeConversionAvailableException: No type converter
available to convert from type:
com.unifyv4.ws.CreateOrganisationResponse to the required type:
java.io.InputStream with value
com.unifyv4.ws.CreateOrganisationResponse#2c9a5080
at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:141)[235:org.apache.camel.camel-jaxb:2.15.1.redhat-621084]
at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:83)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline.access$100(Pipeline.java:44)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:139)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:251)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:460)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:86)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.SendProcessor$1.done(SendProcessor.java:149)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.component.cxf.CxfClientCallback.handleResponse(CxfClientCallback.java:61)[207:org.apache.camel.camel-cxf:2.15.1.redhat-621084]
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:823)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1644)[96:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-621084]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1155)[96:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-621084]
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_40]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_40]
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621084]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_40]
Caused by: org.apache.camel.NoTypeConversionAvailableException: No
type converter available to convert from type:
com.unifyv4.ws.CreateOrganisationResponse to the required type:
java.io.InputStream with value
com.unifyv4.ws.CreateOrganisationResponse#2c9a5080
at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:177)[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:122)[204:org.apache.camel.camel-blueprint:2.15.1.redhat-621084]
at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:172)[235:org.apache.camel.camel-jaxb:2.15.1.redhat-621084]
at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:138)[235:org.apache.camel.camel-jaxb:2.15.1.redhat-621084]
... 20 more
Below is the blueprint.xml file and class where I'm trying to marshal the response object.
Blueprint.xml
<cxf:rsServer id="crmRequest" address="http://localhost:9002/rest/" serviceClass="com.spectranet.createEnterpriseCustomer.ReceiveEnterpriseRequest" />
<bean id="crmRequestBean" class="com.spectranet.createEnterpriseCustomer.ReceiveEnterpriseRequest" />
<bean id="myProcessor" class="com.spectranet.createEnterpriseCustomer.MyProcessor" />
<bean id="myProcessor2" class="com.spectranet.createEnterpriseCustomer.MyProcessor2" />
<bean id="dozerConverterLoader" class="org.apache.camel.converter.dozer.DozerTypeConverterLoader">
<argument index="0" ref="myCamel" />
<argument index="1" ref="createOrg" />
</bean>
<bean id="createOrg" class="org.apache.camel.converter.dozer.DozerBeanMapperConfiguration">
<property name="mappingFiles">
<list>
<value>transformation.xml</value>
</list>
</property>
</bean>
<cxf:cxfEndpoint id="unifyCreateOrg" address="http://203.122.58.158:9080/unifyejb/CRMAPI" serviceClass="com.unifyv4.ws.CRMAPI" serviceName="com.unifyv4.ws.CRMAPIService" wsdlURL="wsdl/CRMAPI_WSDL.wsdl" />
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
<endpoint uri="dozer:createOrg?sourceModel=com.spectranet.createEnterpriseCustomer.CRMCAFRequest&targetModel=com.unifyv4.ws.CreateOrganisation&mappingFile=transformation.xml" id="crmToUnify"/>
<dataFormats>
<jaxb contextPath="generated" id="generated"/>
<jaxb contextPath="com.unifyv4.ws" prettyPrint="true" encoding="UTF-8" partClass="com.unifyv4.ws.CreateOrganisationResponse" id="myPartialJaxb"/>
</dataFormats>
<route>
<from uri="cxfrs:bean:crmRequest" id="crmRequest">
<description/>
</from>
<convertBodyTo type="com.spectranet.createEnterpriseCustomer.CRMCAFRequest"/>
<to pattern="InOut" ref="crmToUnify"/>
<setHeader headerName="Username">
<constant>admin</constant>
</setHeader>
<setHeader headerName="Password">
<constant>admin</constant>
</setHeader>
<setHeader headerName="operationName">
<constant>createOrganisation</constant>
</setHeader>
<setHeader headerName="operationNameSpace">
<constant>http://ws.unifyv4.com/</constant>
</setHeader>
<log message="customer: ${in.body.organisation.customer}"/>
<log message="ipAddress: ${in.body.sessionObject.ipAddress}"/>
<process ref="myProcessor"/>
<to pattern="InOut" uri="cxf:bean:unifyCreateOrg"/>
<marshal ref="myPartialJaxb"/>
<log message="Messsage from soap call is : ${body}"/>
</route>
</camelContext>
Java Code to Marshal the object to xml.
package com.spectranet.createEnterpriseCustomer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import com.unifyv4.ws.CreateOrganisationResponse;
import com.unifyv4.ws.Organisation;
public class MyProcessor2 implements Processor {
public void process(Exchange exchng) throws Exception {
CreateOrganisationResponse orgResponse = new CreateOrganisationResponse();
orgResponse.setReturn(exchng.getIn().getBody(Organisation.class));
System.out.println("Organisation Created : " + orgResponse.getReturn().getOrgNo());
exchng.getIn().setBody(orgResponse);
}
}
Kindly please provide any suggestions if any.
First of all, may I know why you want to marshal ?
Looking at route, I dont think you need to marshal any payload.
Just play around XPATH, XSLT & Camel. Camel becomes more complicated in-fact, if you want to marshal and unmarshal. I am not saying its wrong, I am saying its easier without the hassle of marshal, unmarshal, etc. Because ultimately thats what all frameworks do internally. :)
Eg: https://github.com/gnanagurus/camel-guru-projects/tree/master/camel-cxf-geocoder-example
Cheers
This issue can come when the generated class does not contain XML root element tag. Because of it, framework can not explicitly convert the objects to XML and vice versa.
Hence you are creating the response via processor, please refer your WSDL and create the wrapper response as well.
Thanks
Shiv
We are having a problem in a Data Service on WSO2 DSS 3.0.0. If I execute directly the query on the database I get no error. The database is a Sybase version 12.
DBS
<data name="DSProgram" serviceNamespace="http://myschema.org.br">
<config id="ProgramDS">
<property name="carbon_datasource_name">ProgramDS</property>
</config>
<query id="updateProgram" useConfig="ProgramDS">
<sql>update aca..program set name = :name, endingdate = (case when :endingdate = '' then null else :endingdate) where course = :course</sql>
<param name="name" sqlType="STRING"/>
<param name="endingdate" sqlType="STRING"/>
<param name="course" sqlType="INTEGER"/>
</query>
<operation name="updateProgram">
<call-query href="updateProgram">
<with-param name="name" query-param="name"/>
<with-param name="endingdate" query-param="endingdate"/>
<with-param name="course" query-param="course"/>
</call-query>
</operation>
</data>
SOAP Envelope
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://myschema.org.br">
<soapenv:Header/>
<soapenv:Body>
<int:updateProgram>
<int:name>Course name</int:name>
<int:endingdate></int:endingdate>
<int:course>999</int:course>
</int:updateProgram>
</soapenv:Body>
</soapenv:Envelope>
SOAP Fault
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault xmlns:axis2ns1820="http://ws.wso2.org/dataservice">
<faultcode>axis2ns1820:DATABASE_ERROR</faultcode>
<faultstring>DS Fault Message: Error in DS non result invoke.
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: DSProgram
Location: /DSProgram.dbs
Description: N/A
Default Namespace: http://myschema.org.br
Current Request Name: updateProgram
Current Params: {endingdate=, course=999, name=Course name}
Nested Exception:-
java.lang.NullPointerException</faultstring>
<detail>
<axis2ns1819:DataServiceFault xmlns:axis2ns1819="http://ws.wso2.org/dataservice">DS Fault Message: Error in DS non result invoke.
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: DSProgram
Location: /DSProgram.dbs
Description: N/A
Default Namespace: http://myschema.org.br
Current Request Name: updateProgram
Current Params: {endingdate=, course=999, name=Course name}
Nested Exception:-
java.lang.NullPointerException</axis2ns1819:DataServiceFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
* Data changed for confidenciality
WSO2 DSS System Log
TID[-1234] [DSS] [2015-05-12 10:51:30,156] ERROR {org.wso2.carbon.dataservices.core.engine.DataService} - DS Fault Message: Error in 'SQLQuery.processNormalQuery' DS Code: DATABASE_ERROR Source Data Service:- Name: DSProgram Location: /DSProgram.dbs Description: N/A Default Namespace: http://myschema.org.br Current Request Name: updateProgram Current Params: {endingdate=, course=999, nome=Course name} Nested Exception:- java.lang.NullPointerException org.wso2.carbon.dataservices.core.description.query.SQLQuery.processNormalQuery(SQLQuery.java:808) org.wso2.carbon.dataservices.core.description.query.SQLQuery.runQuery(SQLQuery.java:2098) org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:252) org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:179) org.wso2.carbon.dataservices.core.engine.CallQueryGroup.executeElement(CallQueryGroup.java:111) org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89) org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71) org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:569) org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:99) org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110) org.wso2.carbon.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:80) org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:127) org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:76) org.wso2.carbon.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:282) org.wso2.carbon.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:39) org.wso2.carbon.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:48) org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181) org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172) org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146) org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90) org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111) org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:172) org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source)
I think you have a SQL sintax error:
<sql>update aca..program (...)</sql>
Two dots at schema.table?
I am using wso2 esb 4.8.1. I am trying to do xml to xml transformation with the help of smooks mediator but I am getting following exception when is hit request from the try it from application deployment console of wso2,
[2014-11-07 09:39:20,401] ERROR - SmooksMediator Failed to filter source.
org.milyn.SmooksException: Failed to filter source.
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:86)
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:61)
at org.milyn.Smooks._filter(Smooks.java:516)
at org.milyn.Smooks.filterSource(Smooks.java:475)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:123)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)
at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:70)
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:75)
... 15 more
[2014-11-07 09:39:20,417] ERROR - NativeWorkerPool Uncaught exception
org.wso2.carbon.mediator.service.MediatorException: Failed to filter source. Caused by Failed to filter source.
at org.wso2.carbon.mediator.transform.SmooksMediator.handleException(SmooksMediator.java:242)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:137)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
seqence xml is as below,
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="smooksTransService" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="full" separator=","/>
<smooks config-key="gov:/_system/config/transforms/smooksconfig.xml">
<input type="text"/>
<output type="xml"/>
</smooks>
<log level="full" separator=","/>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>
Below is smooks configuration file,
<?xml version="1.0" encoding="UTF-8"?><smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
<params>
<param name="stream.filter.type">SAX</param>
<param name="inputType">input.xml</param>
<param name="default.serialization.on">true</param>
<param name="input.xml" type="input.type.actived">File:/C:\Shailesh\xmls\model-input.xml</param>
</params>
<ftl:freemarker applyOnElement="#document">
<ftl:template><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<h:salesorder xmlns:h="http://www.w3.org/TR/html4/">
<h:details>
<h:orderid>${.vars["order"]["#id"]}</h:orderid>
<h:customer>
<h:id>${.vars["order"]["header/customer/#number"]}</h:id>
<h:name>${.vars["order"]["header/customer"]}</h:name>
</h:customer>
</h:details>
<#list .vars["order"]["order-items"] as order_items>
<h:itemList>
<#list .vars["order_items"]["order-item"] as order_item>
<h:item>
<h:id>${.vars["order_item"]["#id"]}</h:id>
<h:productId>${.vars["order_item"]["product"]}</h:productId>
<h:quantity>${.vars["order_item"]["quantity"]}</h:quantity>
<h:price>${.vars["order_item"]["price"]}</h:price>
</h:item>
</#list>
</h:itemList>
</#list>
</h:salesorder>]]></ftl:template>
<param name="modelSrc">File:/C:\Shailesh\xmls\model-output.xml</param>
<param name="modelSrcType">XML</param>
<param name="mess![enter image description here][2]ageType">XML</param>
<param name="templateDataProvider">input</param>
</ftl:freemarker>
<resource-config selector="#document">
<resource>org.milyn.delivery.DomModelCreator</resource>
</resource-config>
</smooks-resource-list>
My request for proxy service is as shown in attached image.
I didn't go through your example thoroughly, but it seems the error is that the Smooks Mediator cannot find the registry resource.
Looks like there is an issue when you specify the smooks config-key attribute. When you are working with the registry, you need to know that there are different registry spaces.
If you refer a resource via "gov:", the resource will be in "/_system/governance". You need to use "conf:" to refer a resource in "/_system/config".
For eg: If you have a resource in "/_system/config/transforms/smooksconfig.xml", you need to refer it as follows:
"conf:transforms/smooksconfig.xml"
Related question: Howto access registry in WSO2 ESB
I hope this helps.