Author |
Message |
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
Hi,
I'm attempting my first REST connection in OD 8.0.0.2201. I'm using this endpoint provided to me
https://ea-mule-dev.corpadds.com/cea-ivr-sfdc-ivrprocess/v1/authenticate
with this json body
{
"IVRBranchId": "123",
"IVRPayrollId": "45670",
"IVRPin": "4321"
}
I first set this up in SoapUI and I get back the proper response shown here so I know the endpoint and body are accurate.
{
"result": "Success",
"message": "AuthenticationResponse",
"info": {
"Season": {"PayrollSeason": "RegularSeason"},
"Account": {
"Status": "Active",
"Platform": "Blue"
}
}
}
When I try to use that same endpoint and same Message Body values in the Web Service Operation Editor I get "Error: Content is not allowed in prolog."
Any ideas?
Thanks
|
|
|
|
|
WilsonYu
Joined: Nov 6, 2013
Messages: 3947
Offline
|
You will need the attached patch to resolve this issue.
|
|
|
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
I gave that a shot.
I'm still getting the same error after applying the new jar and completely restarting.
"Error: Content is not allowed in prolog"
I'm getting the message when trying to save the WS file, not during the export of the application, if that makes a difference.
|
|
|
|
|
WilsonYu
Joined: Nov 6, 2013
Messages: 3947
Offline
|
Check under the project's WEB-INF/lib to see of the jar file has been updated.
|
|
|
|
|
WilsonYu
Joined: Nov 6, 2013
Messages: 3947
Offline
|
One more thing, the message body needs to start with "JSON":
JSON{
"x":"y"
}
|
|
|
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
Thank you so much it was the missing JSON before the body that solved the issue.
|
|
|
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
Still having an issue with the web service connector.
I have restResults configured as a simple variable you can see in the log that it shows Store [] to restResults, it's always empty despite the web service reply responding properly.
I've attached a screenshot of the Output Parameters section from my restNew.rest file if that helps.
23/03/2021 11:13:32:212 DEBUG - 8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox : Web Service Request -> https://ea-mule-dev.corpadds.com/cea-ivr-sfdc-ivrprocess/v1/authenticate
23/03/2021 11:13:35:037 INFO - 8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox : variable reference is simple true
23/03/2021 11:13:35:037 INFO - 8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox : return data is a collection false
23/03/2021 11:13:35:039 DEBUG - 8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox : Storing [] to: restResults
23/03/2021 11:13:35:040 DEBUG - 8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox : Web Service Reply <- {"result":"Success","message":"AuthenticationResponse","info":{"Season":{"PayrollSeason":"RegularSeason"},"Account":{"Status":"Active","Platform":"Blue"}}}
23/03/2021 11:13:35:041 INFO - 8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox : Using SCESession
Here I kick off a servlet to parse the json response but it is always blank.
8FD2DEE3314F590EE419D8681AB4A2D6:/Sandbox servlet : ParseJson
JSONObject json = new JSONObject(mySession.getVariableField(IProjectVariables.REST_RESULTS).getObjectValue());
|
|
|
|
|
WilsonYu
Joined: Nov 6, 2013
Messages: 3947
Offline
|
Try changing the Output Format to either JSON or String.
|
|
|
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
Hi Wilson,
Still having an issue with receiving the complete REST reply to a simple variable.
02/04/2021 16:39:08:406 INFO - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Using SCESession FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox servlet : untitledData1
02/04/2021 16:39:08:488 INFO - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Starting REST web service operation [restNewString]
02/04/2021 16:39:08:722 INFO - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Using No Authentication for web service call, keystore : file:/ on port : 443
02/04/2021 16:39:08:726 DEBUG - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Web Service Request -> https://ea-mule-dev.corpadds.com/cea-ivr-sfdc-ivrprocess/v1/authenticate
02/04/2021 16:39:10:178 INFO - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : variable reference is simple true
02/04/2021 16:39:10:178 INFO - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : return data is a collection false
02/04/2021 16:39:10:180 DEBUG - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Storing [Failure] to: result
02/04/2021 16:39:10:180 DEBUG - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Web Service Reply <- {"result":"Failure","message":"Authentication : PIN entered does not match the existing PIN in the system","info":{}}
02/04/2021 16:39:10:181 INFO - FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox : Using SCESession FD7C3C3BF7A1DDB8F0D8AB15099AFB71:/Sandbox servlet : ParseJson
You can see that the Web Service Reply is perfect, but the result (simple var) only contains the word "Failure", i need to contain the full JSON response {"result":"Failure","message":"Authentication : PIN entered does not match the existing PIN in the system","info":{}}
I've changed the output to JSON and get the same results, new screenshot attached.
|
|
|
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
ps. I know how to parse the object in java IF I could get the full reply as a json object into the simple variable. Thanks
|
|
|
|
|
WilsonYu
Joined: Nov 6, 2013
Messages: 3947
Offline
|
Try to change the parameter name to "(ALL)" instead of "result".
"(ALL)" was the default.
|
|
|
|
|
JNemani
Joined: Apr 6, 2017
Messages: 56
Offline
|
This worked perfectly, I can't thank you enough.....thanks
|
|
|
|
|
JaydeepH
Joined: Feb 24, 2017
Messages: 41
Offline
|
Hello,
I am currently using AOD 7.2.1, Java 8, Tomcat 8.5.43 versions.
I am looking for a REST API sample java code trying to hit a https url.
Appreciate if you can please share it,
Thanks for your support.
Warm regards,
Jaydeep Hatekar
|
|
|
|
|
WilsonYu
Joined: Nov 6, 2013
Messages: 3947
Offline
|
Would the OD REST connector not work? Otherwise, there is so much you can find by just googling.
|
|
|
|
|
JaydeepH
Joined: Feb 24, 2017
Messages: 41
Offline
|
Hi Wilson,
I did not use the in-built RESTful service within AOD. I did manage to develop the customized java code to hit a webservice via https url involving proxy.
Thanks for your support.
Warm regards,
Jaydeep Hatekar
|
|
|