HTTP Receiver. Error while parsing http request for processing: - wso2

logstash output:
output{
if [type]=="nxlog-json"{
http {
codec => json
http_method => "post"
url=>"http://192.168.1.112:9763/endpoints/test"
}
}
}
HTTP Receiver config:
<?xml version="1.0" encoding="UTF-8"?>
<eventReceiver name="test" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver">
<from eventAdapterType="http">
<property name="basicAuthEnabled">false</property>
<property name="transports">all</property>
</from>
<mapping customMapping="disable" type="json"/>
<to streamName="teststream" version="1.0.0"/>
</eventReceiver>
ERROR in log:
ERROR {org.wso2.carbon.event.input.adapter.http.HTTPMessageServlet} -
Error while parsing http request for processing: Path 'event' not
found in the current context:
How to fix it?
WSO2 CEP Version 4.2.0

Solved this issue by wrapping json object via "event":{} as follows.
jsonObject={
"event": {
"payloadData": {
"companyID":companyID,
"activityID":activityID
}
}
}

Related

ERROR {InvokeMediator} - {api:EmailMicroService} Sequence named Value {name ='null', keyValue ='techlogixSmtp'} cannot be found

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.

WSO2 ESB not returning payloads

We're downgrading our ESB from 5.0.0 to 4.8.1 to match a different development environment and we've hit an unexpected snag: our APIs aren't returning anything.
We were originally using the mediator, which I'm gathering was changed between 4.8.1 and 5.0.0 and cannot in the older version be used as a response so we switched to This is a resource I have set up in an effort to get a smoke test up
<resource methods="GET" uri-template="/StaticTest">
<inSequence>
<log level="full"></log>
<loopback></loopback>
</inSequence>
<outSequence>
<log level="full"></log>
<payloadFactory media-type="json">
<format>{"asdf":"fdsa","blah":3}</format>
<args></args>
</payloadFactory>
<respond></respond>
</outSequence>
</resource>
I know the resource is being hit, because the logging statements make it into the logs. In fact, placing another mediator over the respond tag will display the following
[2017-05-09 15:48:19,968] INFO - LogMediator To: ,
MessageID: urn:uuid:6376072e-d005-497e-b7a1-9f89cff49099,
Direction: response,
Envelope: <?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<jsonObject>
<asdf>fdsa</asdf>
<blah>3</blah>
</jsonObject>
</soapenv:Body>
</soapenv:Envelope>
Which I have taken the liberty of formatting a bit. As you can see a soap envelope has been made matching my static JSON object, but SOAP UI is showing nothing. I get an HTTP 200, but no content. Any idea what could cause this?

WSO2 ESB: Can we use Call Mediator for Rest Service to post (POST HTTP Method) the xml request?

When I create proxy with send mediator with Rest service Post HTTP Method in HTTP endpoint url. Selected the endpoint as HTTP endpoint on proxy and post the request xml without soap envelop, this perfectly works and get the response in the response window.
But when I use the call mediator with the same HTTP end point url configuration, this does not works. I would like to know can we use call mediator for Post HTTP method? When I use Call mediator for the GET HTTP method which require only query parameters and does not require any request xml this works absolutely fine.
Here is the further information:
However issue is resloved by using the address endpoint in callmediator. When I Invoke the proxy from external Restt client ot Soap UI, it does works. If I use the Try this Service option in wso2 ESB will fail with the results 1. When Soap12 endpoint is selected and 2 when HTTP end point is selected as shown below.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="postIDMPCall"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="ContentType" value="text/xml" scope="axis2" type="STRING"/>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<organizationList xmlns="">
<xml content>
</organizationList>
</format>
<args/>
</payloadFactory>
<header name="_user" scope="transport" value="username"/>
<header name="_password" scope="transport" value="Password"/>
<call blocking="true">
<endpoint>
<address uri="http://<ip-address>:<port>/<resource-path>/UpdateOrganization"
format="rest"/>
</endpoint>
</call>
</inSequence>
</target>
</proxy>
Output: When soap12 endpoint is selected
Though posted the correct xml service does not recorgonize the correct xml format for soap12 endpoint.
FAILURE
Record is not processed successfully. Please Provide valid Request XML
When Http end point is selected
[2016-04-21 12:07:50,179] INFO - HTTPSender Unable to sendViaPost to url[http://://UpdateOrganization/mediate]
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
I think we can't use call mediator for this purpose because call mediator is context unaware mediator.
Your call should already perform a post out the box.
Did you try to set format="pox" if you expect simple xml as a response

WSO2 response binary why?

If using samples axis2Server service is very good. But when I created my own web-service using javax I got a problem.
I used wso2 esb 4.60 default configuration
Web service:
import javax.jws.WebParam;
import javax.jws.WebService;
#WebService
public class Lpu {
public boolean scheduleAnAppointment(#WebParam(name = "time") Integer time) {
return true;
}
}
starting web-service:
import javax.xml.ws.Endpoint;
public class Server {
public static void main(String[] args)
{
Endpoint.publish("http://localhost:8090/WebServices/lpu", new Lpu());
}
}
config esb:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
<in>
<log level="full"/>
<send>
<endpoint>
<address uri="http://localhost:8090/WebServices/lpu"/>
</endpoint>
</send>
</in>
<out>
<log level="full"/>
<send/>
</out>
</sequence>
</definitions>
response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<axis2ns1:binary xmlns:axis2ns1="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxTOkVudmVsb3BlIHhtbG5zOlM9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj48UzpCb2R5PjxuczI6c2NoZWR1bGVBbkFwcG9pbnRtZW50UmVzcG9uc2UgeG1sbnM6bnMyPSJodHRwOi8vZmVyLndlYnNlcnZpY2UvIj48cmV0dXJuPmZhbHNlPC9yZXR1cm4+PC9uczI6c2NoZWR1bGVBbkFwcG9pbnRtZW50UmVzcG9uc2U+PC9TOkJvZHk+PC9TOkVudmVsb3BlPg==</axis2ns1:binary>
</soapenv:Body>
</soapenv:Envelope>
I want getting:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:scheduleAnAppointmentResponse xmlns:ns2="http://lpu.webservice/">
<return>true</return>
</ns2:scheduleAnAppointmentResponse>
</S:Body>
</S:Envelope>
my reguest
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fer="http://lpu.webservice/">
<soapenv:Header/>
<soapenv:Body>
<lpu:scheduleAnAppointment>
<time>12</time>
</lpu:scheduleAnAppointment>
</soapenv:Body>
</soapenv:Envelope>
ESB 4.6.0 released with pass through transport, which doesnt build the message. So, if you use the log mediator in the sequence you will get the binary response. But at client end you should receive your response in the preferred format.
If you switch to NIO transport, in the sequence also you can get the actual message payload. For that you need to edit the transport sender and receiver in axis2 configuration(axis2.conf)
Change axis2.xml to axis2_nhttp.xml in
/repository/conf/carbon.xml alter:
<ConfigurationFile>${carbon.home}/repository/conf/axis2/axis2_nhttp.xml</ConfigurationFile>
Another suggestion decrypting the payload:
WSO2 responds payload in binary

ESB with PayLoadFactory: error: java.io.IOException: Decompression of response failed

I have this scenario:
I consume some information from a data service and another information from another data service and I want to merge this two information in a unique response.
In this test I don´t use the data services, I use mock services in SOAPUI and both mock services work fine separately .
The data I want to merge, an example:
Data service 1 response:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas">
<soap:Header/>
<soap:Body>
<obt:Personas>
<!--Zero or more repetitions:-->
<obt:Persona>
<obt:idExpediente>T123654</obt:idExpediente>
<obt:primerNombre>yanaka</obt:primerNombre>
<obt:primerApellido>perez</obt:primerApellido>
<obt:segundoApellido>perez</obt:segundoApellido>
<obt:sexo>F</obt:sexo>
<obt:ci>920125848</obt:ci>
<obt:provincia>ok</obt:provincia>
<obt:municipio>yes</obt:municipio>
<obt:area>facultad</obt:area>
<obt:esDocente>false</obt:esDocente>
</obt:Persona>
</obt:Personas>
</soap:Body>
</soap:Envelope>
Data service 2 response:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:preg="http://pregrado.uci.cu">
<soap:Header/>
<soap:Body>
<preg:Personas>
<!--Zero or more repetitions:-->
<preg:Persona>
<preg:idExpediente>11111</preg:idExpediente>
<preg:primerNombre>jorge</preg:primerNombre>
<preg:primerApellido>infante</preg:primerApellido>
<preg:segundoApellido>osorio</preg:segundoApellido>
<preg:sexo>M</preg:sexo>
<preg:ci>1221122112211221</preg:ci>
<preg:provincia>rdf</preg:provincia>
<preg:municipio>dsf</preg:municipio>
<preg:area>df</preg:area>
<preg:esDocente>true</preg:esDocente>
</preg:Persona>
<preg:Persona>
<preg:idExpediente>gero et</preg:idExpediente>
<preg:primerNombre>sonoras imperio</preg:primerNombre>
<preg:primerApellido>quae divum incedo</preg:primerApellido>
<preg:segundoApellido>verrantque per auras</preg:segundoApellido>
<preg:sexo>per auras</preg:sexo>
<preg:ci>circum claustra</preg:ci>
<preg:provincia>nimborum in</preg:provincia>
<preg:municipio>foedere certo</preg:municipio>
<preg:area>profundum quippe ferant</preg:area>
<preg:esDocente>false</preg:esDocente>
</preg:Persona>
</preg:Personas>
</soap:Body>
</soap:Envelope>
So I build this proxy service:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="PersonaPoC"
transports="https,http" statistics="disable" trace="disable"
startOnLoad="true">
<target inSequence="conf:/PersonaPoC/obtener_estudiantes"/>
<publishWSDL key="conf:/wsdl/PersonaSimplev2.wsdl"/>
<description></description>
</proxy>
With this sequences:
Name: obtener_estudiantes.
<sequence xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory>
<format>
<preg:ObtenerEstudiantesPoC xmlns:preg="http://pregrado.uci.cu"/>
</format>
</payloadFactory>
<send receive="conf:/PersonaPoC/guardar_Estudiantes">
<endpoint>
<address uri="http://destrono:8088/mockPregradoWSSOAP12Binding/"/>
</endpoint>
</send>
</sequence>
Name: guardar_Estudiantes.
<sequence xmlns="http://ws.apache.org/ns/synapse">
<enrich>
<source clone="false" type="body"/>
<target action="replace" type="property"
property="listado_estudiantes"/>
</enrich>
<payloadFactory>
<format>
<obt:ObtenerPersonasPoC
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas"/>
</format>
</payloadFactory>
<log level="full"/>
<send receive="conf:/PersonaPoC/unir_Personas">
<endpoint>
<address uri="http://destrono:8888/mockAssetsSOAP12Binding"/>
</endpoint>
</send>
</sequence>
At this point I see this error in the ESB when execute the service:
This is a log of the message send to the second service, mockAssetsSOAP12Binding. I don´t know why appear this namespace:
xmlns:preg=http://pregrado.uci.cu in the request because I don´t used it in the payloadfactory mediator.
[2013-04-10 20:17:17,303] INFO - LogMediator To:
http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: ,
MessageID: urn:uuid:26b0c552-d8e6-4285-8814-84c595dae544, Direction:
response, Envelope:
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:preg="http://pregrado.uci.cu">
<soap:Body>
<obt:ObtenerPersonasPoC
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas"/>
</soap:Body>
</soap:Envelope>
The error:
[2013-04-10 19:49:30,472] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI
at
org.apache.axis2.builder.BuilderUtil.validateSOAPVersion(BuilderUtil.java:77
4)
at
org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:58)
at
org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocumen
t(DeferredMessageBuilder.java:146)
at
org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUti
ls.java:150)
at
org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtil
s.java:91)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:62)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.
java:114)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2Syn
apseEnvironment.java:223)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseC
allbackReceiver.java:443)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbac
kReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:217
)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerP
ool.java:172)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
10)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
03)
at java.lang.Thread.run(Thread.java:722)
when I used the data services in AS 5.1.0 I saw this error:
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found faultstring
If I put the TCPMon I can see this message exchange:
Incoming message:
POST /mockAssetsSOAP12Binding HTTP/1.1
Content-Encoding: gzip
Content-Type: application/soap+xml; charset=UTF-8
Server: Jetty(6.1.x)
Transfer-Encoding: chunked
Host: 127.0.0.1:8888
Connection: Keep-Alive
124
<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:preg="http://pregrado.uci.cu"><soap:Body>
<obt:ObtenerPersonasPoC
xmlns:obt="http://informatizacion.uci.cu/servicios/assets/ObtenerPersonas"/>
</soap:Body></soap:Envelope>
0
Outgoing message:
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Server: Jetty(6.1.x)
1a0
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>Server</soap:Value>
</soap:Code>
<soap:Reason>
<!--1 or more repetitions:-->
<soap:Text xml:lang="en">java.io.IOException: Decompression of response failed</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
0
This is the last sequence.
Name: unir_Personas.
<sequence xmlns="http://ws.apache.org/ns/synapse">
<enrich>
<source clone="false" type="body"/>
<target action=" sibling" type="property"
property="listado_estudiantes"/>
</enrich>
<send/>
</sequence>
Any idea?
I don´t know why appear this namespace:
xmlns:preg=http://pregrado.uci.cu in the request because I don´t used
it in the payloadfactory mediator.
You might get that from your endpoint's response. You are using payload only for body and that particular namespace appears at rootlevel. Anyway, that is not the cause for the issue you are facing. In the middle you mentioned about SOAP12 service . Check the namespace is right, and if your endpoint accepts SOAP 12 requests, change the endpoint format to soap12