Reputation: 91
I'm trying to run the sample code given in the WSO2 Siddhi documentation.
I've replicated what was given there.
@App:name("Http_Request_Response_Tutorial")
@App:description("This app demonstrate the usage of http request sink and http response source")
@source(type='http-response' ,sink.id='cardTypeSink',
@map(type='xml', namespaces = "xmlns=http://localhost/SmartPayments/",
@attributes(creditCardNo = 'trp:creditCardNo',creditCardType = ".")))
@sink(type='log')
define stream EnrichedCreditCardStream (creditCardNo string,creditCardType string);
@sink(type='http-request',publisher.url='https://secure.ftipgw.com/ArgoFire/validate.asmx/GetCardType',method='POST', headers="'Content-Type:application/x-www-form-urlencoded'",
sink.id="cardTypeSink",
@map(type='keyvalue', @payload(CardNumber='{{creditCardNo}}')))
define stream CreditCardStream (creditCardNo string);
In the Event Simulator tab, I passed the values given in the example namely: 154467847759 in the timestamp field and 5555555555554444 in the creditCardNo(STRING).
This is the error that's coming.
[2019-05-22_14-59-14_632] ERROR {org.wso2.extension.siddhi.io.http.source.HttpResponseMessageListener} - No source of type 'http-response' for status code '500' has been defined. Hence dropping the response message. (Encoded)
Upvotes: 0
Views: 380
Reputation: 437
As per the error printed, the request sent to https://secure.ftipgw.com/ArgoFire/validate.asmx/GetCardType returns a 500 response. As you don't have an http-response source to accept 500 responses, the response payload will be dropped.
The behavior you are observing is not reproducable from our end. The tutorial works correctly as demonstrated.
Below is an amended version of the tutorial sample with a dummy endpoint. You can try it.
@App:name("Http_Request_Response_Tutorial")
@App:description("This app demonstrate the usage of http request sink and http response source")
@source(type='http-response' ,sink.id='cardTypeSink',
@map(type='xml', namespaces = "xmlns=http://localhost/SmartPayments/",
@attributes(creditCardNo = 'trp:creditCardNo',creditCardType = ".")))
@sink(type='log')
define stream EnrichedCreditCardStream (creditCardNo string,creditCardType string);
@sink(type='http-request',publisher.url='http://www.mocky.io/v2/5cee2fa1300000013a6e9961',method='POST', headers="'Content-Type:application/x-www-form-urlencoded'",
sink.id="cardTypeSink",
@map(type='keyvalue', @payload(CardNumber='{{creditCardNo}}')))
define stream CreditCardStream (creditCardNo string);
Upvotes: 1
Reputation: 125
According to the error, I think you are not connected to the publisher.url in the stream definition of CreditCardStream.
Make sure the CreditCardStream gets connected to https://secure.ftipgw.com/ArgoFire/validate.asmx/GetCardType before simulating events.
If it is connected successfully, you will get logs like following.
[2019-05-23 12:19:36,713] INFO {org.wso2.extension.siddhi.io.http.sink.HttpSink} - Http_Request_Response_Tutorial:@sink( type = "http-request", publisher.url = "https://secure.ftipgw.com/ArgoFire/validate.asmx/GetCardType", method = "POST", headers = "'Content-Type:application/x-www-form-urlencoded'", sink.id = "cardTypeSink", @map( type = "keyvalue", @payload( CardNumber = "{{creditCardNo}}")))define stream CreditCardStream (creditCardNo string) has successfully connected to https://secure.ftipgw.com/ArgoFire/validate.asmx/GetCardType
[2019-05-23 12:19:55,597] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} - Http_Request_Response_Tutorial : EnrichedCreditCardStream : [Event{timestamp=1558594195597, data=[5555555544444, ], isExpired=false}]
Upvotes: 0