Shwe | 2019-09-26 15:37:45 UTC | #1
Hi Team,
I am trying to Run Data Actions, using Web service integration..I am getting 400 bad request error. Please find the error below:
{ "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "f74f554a-deeb-435c-90da-b21aa9b69277", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [ { "status": 400, "code": "BAD_REQUEST", "message": "The Request URL is malformed. Please enter a valid secure web address.", "messageParams": {}, "details": [], "errors": [] } ] } Also the input configuration would be;
{ "requestUrlTemplate": "https://abc.net:1304/api/IVRService/GetPoliciesBySSN", "requestType": "POST", "headers": { "Content-Type": "application/json", "UserAgent": "Apache-HttpClient/4.1.1 (java 1.5)", "Accept-Encoding": "gzip,deflate" }, "requestTemplate": "{\"GetPoliciesBySSNRequest\":{\"RequestMetaData\": { \"RequestingApplication\": \"${input.RequestingApplication}\"}, \"RequestTxn\": {\"SSNreq\": \"${input.SSNreq}\" } }}" } Output ;
{ "translationMap": {}, "translationMapDefaults": {}, "successTemplate": "[${rawResult}]" } Input contract;
{ "$schema": "json-schema.org#", "type": "object", "required": [ "RequestingApplication", "SSNreq" ], "properties": { "RequestingApplication": { "type": "string" }, "SSNreq": { "type": "string" } }, "additionalProperties": true } Output contract;
{ "$schema": "json-schema#", "type": "object", "properties": { "TransRefGUID": { "type": "string" }, "TransExecDate": { "type": "string" }, "TransExecTime": { "type": "string" }, "Status": { "type": "string" }, "Source": { "type": "string" }, "ResultCode": { "type": "string" }, "ResultCodeDescription": { "type": "string" }, "ResponseTime": { "type": "string" }, "SSNreq": { "type": "string" }, "COMPANYCODE": { "type": "string" }, "DOB": { "type": "string" }, "POLICYKEY": { "type": "string" }, "POLICYNUM": { "type": "string" }, "SSN": { "type": "string" }, "SYSTEMID": { "type": "string" } }, "additionalProperties": true }
I am able to Execute in SOAP UI with no errors, Please let me know if I am doing anything wrong with hitting the server or anything is wrong?
Thanks!!
anon28066628 | 2019-09-26 16:00:50 UTC | #2
Hi Shwetha,
I tried a similar test to your URL and got: "message": "Data Actions only support connecting to web services on port 443."
Can your webservice use the standard HTTPS 443 port?
{ "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "a106c019-c330-4a83-a178-81a95296024b", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [ { "status": 400, "code": "BAD_REQUEST", "message": "Data Actions only support connecting to web services on port 443.", "messageParams": {}, "details": [], "errors": [] } ] }
Shwe | 2019-09-26 20:23:35 UTC | #3
Yes I get the same message, The web services configured in data power invokes a stored procedure by connecting to the database. The data returned by the oracle stored procedure is processed by the Data power web services and is sent back to the IVR application in JSON format So for this requirement am I doing the correct configuration?
Thanks!!
Jason_Mathison | 2019-09-26 18:27:53 UTC | #4
Your requestUrlTemplate is set to connect to abc.net:1304, which means that the data action was requested to connect to abc.net on port 1304. Data Actions only support connecting to the standard HTTPS port of 443.
--Jason
Shwe | 2019-09-26 18:36:12 UTC | #5
Yes that's what data power endpoint url would be...so then do I have to use OAuth for connecting? or any other way around it to hit that endpoint to get data?
anon28066628 | 2019-09-26 18:44:45 UTC | #6
The URL cannot be "https://abc.net:1304/api/IVRService/GetPoliciesBySSN" -- the ":1304" part specifies an HTTP port of 1304, which is not supported. The URL should be:
https://abc.net/api/IVRService/GetPoliciesBySSN
An aside - if you're sending Social Security Numbers through an action, please ensure you're using secure actions with secure flows.
Shwe | 2019-09-26 20:44:07 UTC | #7
I tried the https://dp.net/api/IVRService/GetPoliciesBySSN url getting the below error,
{ "status": 400, "code": "bad.request", "message": "The request could not be understood by the server due to malformed syntax.", "messageParams": {}, "contextId": "416fe757-d073-4735-8b47-7aaecb8078bb", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [ { "status": 403, "code": "BAD_REQUEST", "message": "Unable to get IP for provided target host", "messageParams": {}, "details": [], "errors": [] } ] } Also configured as Basic Auth Thanks!!
Jason_Mathison | 2019-09-27 13:47:14 UTC | #8
dp.net appears to be a defunct local internet provider. Is it possible you have a typo in your URL?
Shwe | 2019-09-27 15:10:24 UTC | #9
Actually url is https://uat.dp.net:1304/IVRService/GetPoliciesBySSN....since it supports only port 443 I removed 1304 and made it https://uat.dp.net/api/IVRService/GetPoliciesBySSN then I am getting 403 bad request error. Not sure how can I call this rest service?
anon28066628 | 2019-09-27 15:20:41 UTC | #10
If the webservice is only available on port 1304, then either (A) the service owner will need to change it to 443, or (B) a middleware service would be needed to accept the requests from PureCloud on 443 and proxy them to the service on 1304.
Shwe | 2019-09-27 15:28:44 UTC | #11
This webservice is used by many application in company so it wont be possible to change it to 443, so is it a way around to do it on Lambda functions and make it work?
anon28066628 | 2019-09-27 15:49:33 UTC | #12
That should work great - you'd integrate a Data Action with the AWS Lambda function, sending the backend service URL, port, headers, etc. as parameter inputs to the data action. The Lambda calls the backend service on 1304 and returns the response to PureCloud.
PureCloud has a Lambda Data Action that simplifies the integration. It's a direct connection between the PureCloud AWS and your AWS. No need to set up complex authentication or API gateway. The request JSON payload from the data action becomes the "event" argument in the Lambda handler, and the Lambda's return value (usually dictionary or hashmap) is delivered as the response to PureCloud.
Here's a simple example of a Python Lambda that works with PureCloud data actions. The action sends a simple payload with one field and returns a random value between 1 and N.
Edit: Again be aware this data action looks like it should be secure, used form a secure call flow. Your Lambda may be in PCI / PII / HIPAA scope as well and shouldn't log or store anything (may need to remove the default lambda logging). It's the customer's responsibility to ensure compliance with any middleware.
import random
def lambda_handler(event, context):
return { "randomInteger": random.randint(1, event['upperBound']) }
expected event:
{ "upperBound": <N> }
https://help.mypurecloud.com/articles/about-the-aws-lambda-data-actions-integration/
Shwe | 2019-09-27 16:20:36 UTC | #13
Thanks!!
Also I would have to hit this service https://uat.dp.net:1304/IVRService/GetPoliciesBySSN with request in JSON format like this { "GetPoliciesBySSNRequest":{ "RequestMetaData": { "RequestingApplication": "XX" }, "Request": {
"SSN": "XXXXXXX"
} } } nd response will be also in same format...so how should I go about doing it? very new to Lambda functions and also to pure cloud..
Thanks for your help!!
anon28066628 | 2019-09-27 16:57:11 UTC | #14
These resources should help get your started (below).
For simple request contracts with only key/value pairs:
{ "PhoneNumber": "317-555-0100" }
The simple input schema will suffice. The input schema for a data action is always "flat", just JSON with simple key/value pairs. If your request is more complex, with nested objects and fields, you'll need to use a request template to structure it. Basically the request template takes the values from the input schema and arranges them in the format required by the webservice.
The response configuration (translationMap and output schema) work similarly, filtering and formatting the response from the webservice in a way that is compatible with the output schema.
https://help.mypurecloud.com/articles/request-configuration-data-actions/
https://help.mypurecloud.com/articles/response-configuration-data-actions/
Shwe | 2019-09-27 18:34:36 UTC | #15
I am aware of this template, initially when I was trying to call web service I did use request template...now since I would have to call rest web service using Lambda so was wondering how would I have to create request with nested objects and fields..but in pure cloud it was easy to use request template....thanks!!
Shwe | 2019-10-01 23:03:56 UTC | #16
Thanks so much!!
system | 2019-11-01 21:46:48 UTC | #17
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 6113