HTTPRequest is not returning a response.
GilbertLS opened this issue · 2 comments
I'm getting back
{data="", errorMessage="", responseCode="0", dataSize="0"}
I know that the post request is going through, because I see the data in my cloudant instance.
Here is the relevant code.
(stream<HTTPResponse> CloudantResponse) = HTTPRequest(CloudantPayload as CP)
{
param
fixedMethod: POST ;
fixedContentType: "application/json" ;
requestBodyAttribute : jsonString ;
sslAcceptAllCertificates : true ;
authenticationType : "STANDARD" ;
authenticationProperties : "ANY_HOST=" + $CLOUDANT_USER_ID + ":" +
$CLOUDANT_PASSWORD ;
url : url ;
}
() as Printer = Custom(CloudantResponse as CR)
{
logic
onTuple CR :
{
println(CR);
}
}
For the HTTPRequest operator you must define the output assignements. Operator parameters starting with 'output..' define a specific output attribute.
In your case you must add the following parameters to the operator invocation:
outputStatusCode: "responseCode";
If you want to output the whole response line use parameter outputStatus
.
The assignment of the response body (data) depends on the returned data type. In many cases
outputBody: "data";
should work.
There is no explicit data size return function but the size of the data attribute should be sufficient in most of the cases. Alternatively you can inspect the response headers with parameter outputHeader
(the type of this attribute must be list)
With parameter errorDiagnostics
you may specify a output attribute that delivers diagnostics information e.g.: when the program execution of the http operation throws an exception.
see also here : https://ibmstreams.github.io/streamsx.inet/doc/spldoc/html/
Ah thanks, I missed the output attributes.