Author Message
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Hi Guys!

Could you please help me...

My development environment: Avaya Aura(r) Orchestration Designer CCXML, Version: 7.0 (7.0.0.1801) Build id: 201311251624, Java 1.7 but compliance compatibility is set to 1.6.
My runtime is: Java 1.6, EP 6.0

I am using REST web service operation.

During wso execution I see the following exceptions in the log file (the full exceptions in attachment):
......
- 3F296E840476846BF433AAFF195AFA46:/WelcomeCall : Starting REST web service operation [LICAPersons]
- Could not get parser from data source for element ["cifId"
javax.xml.stream.XMLStreamException: org.codehaus.jettison.json.JSONException: Expected a ':' after a key at character 5 of {"["cifId"":1000002932}]
at org.codehaus.jettison.mapped.MappedXMLInputFactory.createXMLStreamReader(MappedXMLInputFactory.java:46)
at org.apache.axis2.json.JSONDataSource.getReader(JSONDataSource.java:56)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:238)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:270)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serialize(OMSourcedElementImpl.java:661)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serialize(OMSourcedElementImpl.java:649)
at com.avaya.sce.runtime.connectivity.restws.CallService.parseRestReturn(CallService.java:304)
at com.avaya.sce.runtime.connectivity.restws.Axis2RestStub.toODVariable(Axis2RestStub.java:492)
at com.avaya.sce.runtime.connectivity.restws.Axis2RestStub.execute(Axis2RestStub.java:167)
at com.avaya.sce.runtime.connectivity.restws.CallService.execute(CallService.java:370)
at com.avaya.sce.runtime.Data.evaluateActions(Data.java:191)
at flow.WSO_Persons.executeDataActions(WSO_Persons.java:85)
.....

So, for some reason the answer contains an extra double quotes: {"["cifId"":1000002932}]
and the braces are not at the correct place.

I did the same request in the SOAP UI and I've got the correct answer:
**********************************************
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Date: Mon, 03 Sep 2018 15:45:10 GMT

[{"cifId":1000002932}]
**********************************************

And finally I decided to use "Edit Output" option in the output parameters section in the OD rest file editor.
The result was the same exception: "javax.xml.stream.XMLStreamException: org.codehaus.jettison.json.JSONException: Expected a ':' after a key at character 5 of {"["cifId"":1000002932}]"

Please check the screenshot I have attached.

So, in SOAP UI it does work fine, but from OD it does not work.
Later I tried "Edit Output" option in OD Version: 7.0 (7.0.1.0804) Build id: 201410141416
but the result was the same.

I did not find the same issue on devconnect forum, so, seems it was not discovered.
But I saw https://www.devconnectprogram.com/forums/posts/list/20580.page which could relate...
May be my problem is in JSON format?

So, I would like to understand what can be the reason of such behavior. And I will need to explain it to the customer.

Thanks in advance for your help!
Filename JSONException_Expected_ after_a_key_at_character_5_of_cifId_1000002932.txt [Disk] Download
  • [Thumb - JSONException.png]
[Disk] Download
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
The string returned to the Axis2 REST call does not seem right:

{"["cifId"":1000002932}]

I am not sure why since I don't know your web service.
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Hi Wilson,

Well, yes... I see it as well but I do not know what is the reason.

I tried to use a simple "curl" command and it gave me the correct answer.

[root@appsrv bin]# curl -v http://<IP_Address>:8080/LICAServices/rest/IVR/persons/?phoneNum=9063964088

* About to connect() to <IP_Address> port 8080 (#0)
* Trying <IP_Address>... connected
* Connected to <IP_Address> (<IP_Address>) port 8080 (#0)
> GET /LICAServices/rest/IVR/persons/?phoneNum=9063964088 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: <IP_Address>:8080
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Vary: Accept-Encoding
< Content-Type: application/json;charset=utf-8
< Content-Length: 22
< Date: Wed, 05 Sep 2018 06:07:33 GMT
<
* Connection #0 to host <IP_Address> left intact
* Closing connection #0
[{"cifId":1000002932}][root@appsrv bin]#


One more thing which I noticed is an exception in a Problems view when I press "Edit Output" button
java.lang.NullPointerException

at java.io.StringReader.<init>(Unknown Source)
at com.avaya.sce.restws.ui.utils.XMLUtils.parseXmlString(XMLUtils.java:98)
at com.avaya.sce.restws.ui.utils.XMLUtils.formatXML(XMLUtils.java:76)
at com.avaya.sce.restws.ui.editor.ParameterTable$4.widgetSelected(ParameterTable.java:319)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

Full log is in attachment.

So, we have that SOAP UI does work correctly.
Curl command also works as expected.

Is there
Filename NullPointerException.txt [Disk] Download
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Wilson,
I did another investigation and was able to find the answer.

1. According to the exception stack the problem could be in the avrest-rt-07.00.18.01.jar library.

2. I did reverse engineering and found that avrest-rt-07.00.18.01.jar has no relation to the mt problem. In your library you just do
this._serviceClient.sendReceive(getPayload());
invocation.

3. So, I decided to to find what is going on at the axis2 side (inside libs) but unfortunately they do not have traces in the places I was interested in. Finally I moved from axis2 1.6.2 to axis 1.6.3 and a miracle happened.
I've got in a trace a correct JSON result but it was not properly processed.
Please check attachment JSONObject_vs_JSONArray_Error.txt.

4. Finally I noticed that the problem
Caused by: javax.xml.stream.XMLStreamException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 1 of [{"cifId":1000002932}]


in JSONObject_vs_JSONArray_Error.txt file is related to another devconnect thread
https://www.devconnectprogram.com/forums/posts/list/20580.page
My JSON is like that: [{"cifId":1000002932}]. Starts with '['.
According to all online validator tools it is a valid JSON but as I can see from the thread it is not supported to serialize\deserialze such JSON.
So, I would like to clarify if it was fixed in any future OD release?

5. Another point which disturbing me is the topic which was discussed in this thread https://www.devconnectprogram.com/forums/posts/list/21022.page
Is it possible to have a patch for version 7.0 (7.0.0.1801)?

Thanks in advance for your help!
Filename JSONObject_vs_JSONArray_Error.txt [Disk] Download
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Hi Wilson,

I was able to ask to change JSON format in the answer but still have problems.

Now the answer looks like:
{"personInfo": [
{"cifId": 1016795119}
]}

OR

{"personInfo": [
{"cifId": 1013992780},
{"cifId": 1010899006}
]}

1. If I select
Output Format: JSON
and Use Java Object
then I get the folloing error.
- 99041CA0606E09AFFD082D74D5DAEDF7:/WelcomeCall : EXCEPTION: Unknown object model data source.  Could not create JSON object from unknown source.

- In Progress | session id:srvap396-2018249144346-5 | WelcomeCall:WSO_Persons | | Unknown object model data source. Could not create JSON object from unknown source. | Exception stack trace | EXCEPTION>
java.lang.Exception: Unknown object model data source. Could not create JSON object from unknown source.


2. If I use
Output Format: XML
and Use Java Object
then I have no exception but get Java object of type org.apache.axiom.om.impl.llom.OMSourcedElementImpl
and toString() gives me very strange XML <personInfo><personInfo><cifId>1016795119</cifId></personInfo></personInfo>

3. If I use
Output Format: String or Server Default
and Use Java Object
then I have empty string as a result.

4. If I do not select Use Java Object and Output Format: Server Default
then I have en empty string in my variable

5. If I do not select Use Java Object and Output Format: XML String
then I have in my variable very strange String: "<personInfo><personInfo><cifId>1010899006</cifId></personInfo></personInfo>"
Double "personInfo" tag. Why?

6. If I do not select Use Java Object and Output Format is: JSON String
then I have an error again...
- 85FBDB585186AECC0877BBA6133C8AD2:/WelcomeCall : EXCEPTION: Unknown object model data source.  Could not create JSON object from unknown source.

- In Progress | session id:srvap396-2018249152042-8 | WelcomeCall:WSO_Persons | | Unknown object model data source. Could not create JSON object from unknown source. | Exception stack trace | EXCEPTION>
java.lang.Exception: Unknown object model data source. Could not create JSON object from unknown source.


Guys, I cannot understand what is going on and how to correctly process JSON answer.
What should I do?

Please help... I am really stuck...
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
I did a test and I don't see any problem with

Output format: JSON
Use Java Object

06/09/2018 13:28:01:220 DEBUG - F178E563881F31510812FC6759B5D6F3:/TestRest : Web Service Request -> http://localhost:8082/MyWebProject/MyServlet
06/09/2018 13:28:01:390 DEBUG - F178E563881F31510812FC6759B5D6F3:/TestRest : Storing [{"personInfo":[{"cifId":1013992780},{"cifId":1010899006}]}] to: rsret
06/09/2018 13:28:01:391 DEBUG - F178E563881F31510812FC6759B5D6F3:/TestRest : Web Service Reply <- {"personInfo":[{"cifId":1013992780},{"cifId":1010899006}]}
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Hi Wilson!
Thanks for your help.
Well, I can say that it is my own fault. The problem was in axis 1.6.3.
Shame on me.
After JSON representation was changed (to start with"{") and I did rollback to axis 1.6.3 the problem disappeared.

I did several different attempts and see that axis 1.6.3 makes error happen. I do not know why (I do not have enough time) but 1.6.2 works fine.

So, the original problem was solved. The case is closed.

Thanks a lot one more time.
Go to:   
Mobile view