I have a proxy inside wso2 esb. I used call and I want to send response from call to my outSequence. But it gives me Dss error.I do not use dss at all. Can anyone tell why this error happens and how can I solve this?
this is my proxy code:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="FinaltestProxy"
startOnLoad="true"
statistics="disable"
trace="enable"
transports="https,http,vfs">
<target>
<inSequence>
<input type="text"/>
<output type="xml"/>
</smooks>
<iterate attachPath="//csv-set"
continueParent="true"
expression="//csv-set/search"
preservePayload="true"
sequential="true">
<target>
<sequence>
<call>
<endpoint>
<address format="soap11"
uri="MyEndpoint"/>
</endpoint>
</call>
<respond/>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence>
<property name="OUT_ONLY" value="true"/>
<aggregate>
<completeCondition>
<messageCount max="100000" min="0"/>
</completeCondition>
<onComplete xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"
expression="//Guest">
<log level="full"/>
<send>
<endpoint name="FileEpr">
<address format="soap11"
uri="MyEndpoint"/>
<property name="ContentType" scope="axis2" value="text/xml"/>
</endpoint>
</send>
</onComplete>
</aggregate>
</outSequence>
</target>
/* some code*/
</proxy>
and this is my Error:
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: GuestIdentityService
Location: /ss.dbs
Description: N/A
Default Namespace: http://soa.ut.ac.ir/GuestIdentityService
Current Request Name: searchGuestIdentity
Current Params: {ID=}
Nested Exception:-
java.lang.NumberFormatException: For input string: ""
Looks like you have a dataservice called ss, and it's being called somehow. Remove it if you don't want it. You can remove it from either UI or file system. It's located in repository/deployment/server/dataservices/
there was a blank line in my input and that cause the problem.
Related
Running WSO2 EI 6.2.0
My sequence is very simple:
Receive 1 parameter (mac) from initial request
Call a DS to extract a second parameter (time_hour)
Call a DS with both parameters (mac) and (time_hour)
When calling both DS manually, it works perfectly.
When calling the second DS through ESB I get a strange error.
The sequence:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="somesq" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="$url:mac" name="uri.var.mac" scope="default"
type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="mac" scope="default" type="STRING" value="get-property('uri.var.mac')"/>
<call>
<endpoint>
<http method="GET" uri-template="http://somedomain.internal.com/someservice?var={uri.var.mac}"/>
</endpoint>
</call>
<enrich>
<source clone="true" type="body"/>
<target action="replace" property="payload" type="property"/>
</enrich>
<log level="custom">
<property expression="get-property('payload')" name="bbb" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
<property expression="$ctx:payload//ns2:hour" name="time_hour"
scope="default" type="STRING"
xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns2="http://ws.wso2.org/dataservice"/>
<header action="remove" name="Content-Type" scope="transport"/>
<log level="custom">
<property expression="get-property('uri.var.mac')" name="mac" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
<log level="custom">
<property expression="get-property('time_hour')"
name="time_hour" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
<call>
<endpoint>
<http method="GET" uri-template="http://somedomain.internal.com/someservice?var={uri.var.mac}&hour={time_hour}"/>
</endpoint>
</call>
<log level="custom">
<property name="xxx" value="FIM"/>
</log>
<respond/>
</sequence>
I try to log the parameters before calling the DS and they are correctly printed, but when I use it in the DS Call, the hour={time_hour} parameter is empty.
The output and error:
(...)
TID: [-1234] [] [2018-12-05 12:24:02,562] INFO {org.apache.synapse.mediators.builtin.LogMediator} - mac = 000000000000 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2018-12-05 12:24:02,562] INFO {org.apache.synapse.mediators.builtin.LogMediator} - time_hour = 2018-12-03T11:00:00.000+00:00 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [-1234] [] [2018-12-05 12:24:02,569] ERROR {org.wso2.carbon.dataservices.core.DBInOutMessageReceiver} - Error in in-out message receiver {org.wso2.carbon.dataservices.core.DBInOutMessageReceiver}
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processPreNormalQuery': DS Fault Message: Error processing parameter - hour, Error - DS Fault Message: Empty string or null value was found as timeStamp.
DS Code: UNKNOWN_ERROR
DS Code: UNKNOWN_ERROR
Nested Exception:-
DS Fault Message: Empty string or null value was found as timeStamp.
DS Code: UNKNOWN_ERROR
DS Code: DATABASE_ERROR
Source Data Service:-
Name: some_seq
Location: /some_seq.dbs
Description: Some Seq
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: somesq
Current Params: {hour=, mac=000000000000}
Nested Exception:-
DS Fault Message: Error processing parameter - hour, Error - DS Fault Message: Empty string or null value was found as timeStamp.
DS Code: UNKNOWN_ERROR
(...)
Anyone knows how to correctly reference the time_hour parameter to the data services in the ESB Sequence?
Explanation of why the variable time_hour was not being evaluated
From WSO2 Documentation:
The URI templates allow a RESTful URI to contain variables that can be
populated during mediation runtime using property values whose names
have the "uri.var" prefix.
The Final Sequence that is working based on Jan's response:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="some_seq" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="$url:mac" name="uri.var.mac" scope="default"
type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<call>
<endpoint>
<http method="GET" uri-template="http://somedomain.internal.com/someservice?var=={uri.var.mac}"/>
</endpoint>
</call>
<enrich>
<source clone="true" type="body"/>
<target action="replace" property="payload" type="property"/>
</enrich>
<property expression="$ctx:payload//ns2:hour"
name="uri.var.time_hour" scope="default" type="STRING"
xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns2="http://ws.wso2.org/dataservice"/>
<header action="remove" name="Content-Type" scope="transport"/>
<call>
<endpoint>
<http method="GET" uri-template="http://somedomain.internal.com/someservice?var=={uri.var.mac}&hour={uri.var.time_hour}"/>
<property name="time_h" value="{time_hour}"/>
</endpoint>
</call>
<respond/>
</sequence>
It needs 'uri.var' as variable name for it to be usable as uri-template variable.
So create a property with the current time. (I'm surprised btw that 'time_hour' works for you, in my case I used SYSTEM_DATE, time_hour reverts to 'null' )
<property expression="get-property('SYSTEM_DATE')" name="uri.var.time_hour"/>
and use that in your endpoint.
My goal is to put messages that return a soap error on a queue, in order to retry them later.
I have nearly all working, but the most important part : I can't access the original message from the fault sequence of my proxy :(
I first made a proxy service that returns an error for a given value, or OK for the other values :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="TestProxyService" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="custom">
<property name="TestProxyService" value="InSequence"/>
</log>
<switch xmlns:bnc="http://bnc.org/" source="//bnc:id">
<case regex="1">
<log level="custom">
<property name="TestProxyService" value="Send Error !"/>
</log>
<makefault version="soap11">
<code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch"/>
<reason value="ERROR ERROR ERROR"/>
<detail>ERROR</detail>
</makefault>
<respond/>
</case>
<default>
<log level="custom">
<property name="TestProxyService" value="No Error"/>
</log>
<log level="custom">
<property name="id" expression="//bnc:id"/>
</log>
<payloadFactory media-type="xml">
<format>
<bnc:response>OK</bnc:response>
</format>
<args/>
</payloadFactory>
<respond/>
</default>
</switch>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>
And it works fine
I then made another proxy, that uses the first one as an endpoint to test the queuing on error :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="QueuingProxyService" transports="https http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
<send>
<endpoint key="TestProxyServiceEndpoint"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
<store messageStore="No1MessageStore"/>
<makefault version="soap11">
<code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch"/>
<reason value="There has been an error"/>
<detail>We will retry later</detail>
</makefault>
<send/>
</faultSequence>
</target>
</proxy>
The message that is stored is the one made by the makefault in the TestProxy
I tried to save the original message in a property (in the inSequence) with
<property name="OriginalBody" expression="$body" scope="axis2" type="OM"/>
but in the faultSequence, when i do this :
<log level="custom">
<property name="OriginalBody" expression="get-property('OriginalBody')"/>
</log>
I got null as a result :(
Does anyone have an idea ?
Thanks !
remove scope "axis2" when defining property "OriginalBody" or explicitely specify scope="default" :
<property name="OriginalBody" expression="$body" type="OM"/>
with wso2esb 4.7.0 i deployed the following service to perform a proxy and expose the same json i get from a different server:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="crmws"
transports="http"
statistics="enable"
trace="enable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="messageType" value="text/xml" scope="axis2"/>
<cache id="c1"
scope="per-host"
collector="false"
hashGenerator="org.wso2.caching.digest.DOMHASHGenerator"
timeout="6"
maxMessageSize="10000">
<implementation type="memory" maxSize="10000"/>
</cache>
<send>
<endpoint>
<address uri="http://crm/backoffice/webservice.php" format="rest">
<timeout>
<duration>3000</duration>
<responseAction>fault</responseAction>
</timeout>
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<property name="messageType" value="application/json" scope="axis2"/>
<cache id="c1" scope="per-host" collector="true"/>
<send/>
</outSequence>
</target>
<description/>
</proxy>
i then try to implement some cache functionality, but even if first connection goes well, when i hit cache i get an empty answer with text/xml content-type.
UPDATE 20131204
I try again after 4.8.0 release and then enabling cache i get the full representation of my json in xml when i hit cache
anyone know where i have to look to fix this issue?
regards,
try adding the following property in your insequence.
eg:
<inSequence>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
---------------------------
my issue is i am getting data or json or string from front end or mobile app which contains details of error i need append the all details in single txt file in my local system
how can i do this we have any mediator for this or may i use vfs trnsport let me knoe i tried with this code giving error
My config is:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="FileWrite" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="custom">
<property name="sequence" value="fileWriteSequence"/>
</log>
<log>
<property name="transport.vfs.ReplyFileName" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')"/>
<property name="OUT_ONLY" value="true"/>
</log>
<send>
<endpoint>
<address uri="///home/youtility2/Desktop/Errorlog"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<description></description>
</proxy>
Error throing from esb side
2013-04-01 15:58:04,707] ERROR - ClientUtils The system cannot infer the transport information from the ///home/youtility2/Desktop/Errorlog URL.
[2013-04-01 15:58:04,708] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: The system cannot infer the transport information from the ///home/youtility2/Desktop/Errorlog URL.
at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81
) have any refernace let me know.
You need to append the "transport.vfs.Append=true" to out-file URI to append the data in to the existing file... There is a thread regarding this in stackoverflow see the [1]. For more details regarding the VFS please refer the [2].
[1] How to append response message to a text file?
[2] http://docs.wso2.org/wiki/display/ESB403/VFS+Transport
Regards,
Mohan
Sequence Defined inside Log mediator.Define like below
<inSequence>
<log level="full"/>
<property name="sequence" value="fileWriteSequence"/>
<property name="transport.vfs.ReplyFileName" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')"/>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="///home/youtility2/Desktop/Errorlog"/>
</endpoint>
</send>
</inSequence>
I have a service returns a text/plain content. The response message like:
RESP0Success"
But in ESB4.0.3, the response is like:
<text xmlns="http://ws.apache.org/commons/ns/payload"><?xml version="1.0" encoding="UTF-8"?><message><MsgType>RESP</MsgType><ReturnCode>0</ReturnCode><ReturnMessage>Success</ReturnMessage></message>
</text>
I set builder and formatter in axis2.xml. But no use.
<messageBuilder contentType="text/plain"
class="org.apache.axis2.format.PlainTextBuilder"/>
<messageFormatter contentType="text/plain"
class="org.apache.axis2.format.PlainTextFormatter"/>
Can anyxone tell me how to set the builder and formatter in axis2.xml? My service config is:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="TextPlain" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="ContentType" value="text/plain" scope="axis2" />
<log level="full" />
</inSequence>
<outSequence>
<log level="full" />
<property name="ContentType" value="text/plain" scope="axis2" />
<send />
</outSequence>
<endpoint>
<address uri="http://172.20.28.206:8080/AAAService/recieveMsg" format="pox">
</address>
</endpoint>
</target>
</proxy>
I've had the same problem, then I set
<property name="messageType" value="text/plain" scope="axis2"/>
and now it works, if i call it from URL, it will return only text.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="RESTE" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
</inSequence>
<outSequence>
<log level="full"/>
<property name="messageType" value="text/plain" scope="axis2"/>
<send/>
</outSequence>
<endpoint>
<address uri="http://10.15.21.189:8180/contadorServicos/ola-mundo"/>
</endpoint>
</target>
<parameter name="serviceType">proxy</parameter>
<description></description>
</proxy>
Unfortunattely the Tryit functionality stoped working, now it giver the following error.
<parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml">Erro no processamento de XML: formatação incorreta Posição: http://xxxxxxx/services/RESTE?tryit# Número da linha 1, coluna 221:
<sourcetext><TryitProxyError h:status='SOAP envelope error' xmlns:h='http://wso2.org/ns/TryitProxy'>org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'r' (code 114) in prolog; expected '<'at [row,col {unknown-source}]: [1,1]</TryitProxyError> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^</sourcetext>
</parsererror>
p.s: When I use other tools like SOAPUI, it works correctly.
You need to specify the ContentType of your message. As the input from the HTTP will contain the Soap envelope and body, your content is being included inside such a tag.
When you now tell your endpoint, that the message is of type text/plain, the PlainTextFormatter will convert it to real text and send it your endpoint (the axis2.xml is only the config - now you need to tell that you want to use now the PlainTextFormatter)
This line is missing:
<property name="ContentType" value="text/plain" scope="axis2"/>