BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Follow BOB on Twitter! 
Follow BOB on Twitter! (Opens a new window)  

General Notice: No events within the next 45 days.

Partial result from json response in ServiceWebREST API call


 
Search this topic... | Search DI: Realtime and NRDM... | Search Box
Register or Login to Post    Forum Index -> Data Integrator -> DI: Realtime and NRDM  Previous TopicPrint TopicNext Topic
Author Message
vegaelce
Forum Member
Forum Member



Joined: 14 Feb 2009

Posts: 5



PostPosted: Sun Jan 29, 2017 11:03 am 
Post subject: Partial result from json response in ServiceWebREST API call

Hi,

I have a problem to extract data from json response of a ServiceWebREST API.

With SOAPUI, I generated the WADL with a xsd structure for the response (between the grammars tags) :

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
<doc xml:lang="en" title="https://xxxxx.xxxxx.com"/>
<grammars>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Response" type="_Response"/>
<xs:complexType name="Response_items">
<xs:sequence>
<xs:element name="e" type="items_e" maxOccurs="5"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="_Response">
<xs:sequence>
<xs:element name="etag" type="xs:string"/>
<xs:element name="items" type="Response_items"/>
<xs:element name="kind" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="items_e">
<xs:sequence>
<xs:element name="kind" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="value" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</grammars>
<resources base="https://xxxxx.xxxxx.com">
<resource path="_ah/api/category/v1/libraries/xxxxxx/categories/xxxxx/values" id="Values">
<doc xml:lang="en" title="Values"/>
<param name="securityCode" type="xs:string" required="false" style="query" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
<method name="GET" id="Values">
<doc xml:lang="en" title="Values"/>
<request/>
<response status="200">
<representation mediaType="application/json; charset=UTF-8" element="Response" xmlns:json="http://wadl.dev.java.net/2009/02/json"/>
</response>
</method>
</resource>
</resources>
</application>


I created the Service Web REST Datastore and import successfully the function names "values".
In my job, I call successufully the function, and, in the traces of DS, I can read the response with all data :

13788 13780 ROW 29/01/2017 16:35:47 Transform <Query_1-Function2:a40c980> is importing row <>.
13788 13780 TRAN 29/01/2017 16:35:47 GET /_ah/api/category/v1/libraries/xxxxxx/categories/xxxxx/values?securityCode=xxxxxxxxxx
13788 13780 TRAN 29/01/2017 16:35:47 HTTP/1.1
13788 13780 TRAN 29/01/2017 16:35:47 Host: xxxxx.xxxxx.com
13788 13780 TRAN 29/01/2017 16:35:47 Content-Type: application/json; charset=utf-8
13788 13780 TRAN 29/01/2017 16:35:47 Accept: application/json
13788 13780 TRAN 29/01/2017 16:35:47 HTTP/1.1 200 OK
13788 13780 TRAN 29/01/2017 16:35:47 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
13788 13780 TRAN 29/01/2017 16:35:47 Pragma: no-cache
13788 13780 TRAN 29/01/2017 16:35:47 Expires: Mon, 01 Jan 1990 00:00:00 GMT
13788 13780 TRAN 29/01/2017 16:35:47 Date: Sun, 29 Jan 2017 15:35:47 GMT
13788 13780 TRAN 29/01/2017 16:35:47 Content-Type: application/json; charset=UTF-8
13788 13780 TRAN 29/01/2017 16:35:47 Set-Cookie *******
13788 13780 TRAN 29/01/2017 16:35:47 Set-Cookie *******
13788 13780 TRAN 29/01/2017 16:35:47 X-Content-Type-Options: nosniff
13788 13780 TRAN 29/01/2017 16:35:47 X-Frame-Options: SAMEORIGIN
13788 13780 TRAN 29/01/2017 16:35:47 X-XSS-Protection: 1; mode=block
13788 13780 TRAN 29/01/2017 16:35:47 Server: GSE
13788 13780 TRAN 29/01/2017 16:35:47 Alt-Svc: quic=":443"; ma=2592000; v="35,34"
13788 13780 TRAN 29/01/2017 16:35:47 Accept-Ranges: none
13788 13780 TRAN 29/01/2017 16:35:47 Vary: Accept-Encoding
13788 13780 TRAN 29/01/2017 16:35:47 Transfer-Encoding: chunked
13788 13780 TRAN 29/01/2017 16:35:47
13788 13780 TRAN 29/01/2017 16:35:47 265
13788 13780 TRAN 29/01/2017 16:35:47 {
13788 13780 TRAN 29/01/2017 16:35:47 "kind": "xxx#categoryValueList",
13788 13780 TRAN 29/01/2017 16:35:47 "items": [
13788 13780 TRAN 29/01/2017 16:35:47 {
13788 13780 TRAN 29/01/2017 16:35:47 "kind": "xxx#categoryValue",
13788 13780 TRAN 29/01/2017 16:35:47 "name": "val1",
13788 13780 TRAN 29/01/2017 16:35:47 "value": "Q8rO7mG4aGnXrtb4VT"
13788 13780 TRAN 29/01/2017 16:35:47 },
13788 13780 TRAN 29/01/2017 16:35:47 {
13788 13780 TRAN 29/01/2017 16:35:47 "kind": "xxx#categoryValue",
13788 13780 TRAN 29/01/2017 16:35:47 "name": "val2",
13788 13780 TRAN 29/01/2017 16:35:47 "value": "Q8rO7QJ00ypNnh0hL3"
13788 13780 TRAN 29/01/2017 16:35:47 },
13788 13780 TRAN 29/01/2017 16:35:47 {
13788 13780 TRAN 29/01/2017 16:35:47 "kind": "xxx#categoryValue",
13788 13780 TRAN 29/01/2017 16:35:47 "name": "val3",
13788 13780 TRAN 29/01/2017 16:35:47 "value": "Q8rO85W0NsGvU89VqW"
13788 13780 TRAN 29/01/2017 16:35:47 },
13788 13780 TRAN 29/01/2017 16:35:47 {
13788 13780 TRAN 29/01/2017 16:35:47 "kind": "xxx#categoryValue",
13788 13780 TRAN 29/01/2017 16:35:47 "name": "valman1",
13788 13780 TRAN 29/01/2017 16:35:47 "value": "Q8rR1Ex1oQxDpWybZB"
13788 13780 TRAN 29/01/2017 16:35:47 },
13788 13780 TRAN 29/01/2017 16:35:47 {
13788 13780 TRAN 29/01/2017 16:35:47 "kind": "xxx#categoryValue",
13788 13780 TRAN 29/01/2017 16:35:47 "name": "valman2",
13788 13780 TRAN 29/01/2017 16:35:47 "value": "Q8rU6AP5L4nUUNzltq"
13788 13780 TRAN 29/01/2017 16:35:47 }
13788 13780 TRAN 29/01/2017 16:35:47 ],
13788 13780 TRAN 29/01/2017 16:35:47 "etag": "\"SK9rTZDwMWQziLS1EaQOSfErSSg/BFr4zYLxnDCYuxn9Ger0L1DMlZo\""
13788 13780 TRAN 29/01/2017 16:35:47 }
13788 13780 TRAN 29/01/2017 16:35:47 0
13788 13780 ROW 29/01/2017 16:35:47 Transform <Query_1-Function2:000000000A40C980> is exporting row <,0,NULL,0>.


But when I try to get the results in a table (after schema unnested) or in the debugger (breakpoint just after the call of the API function), I can see only the correct values for "kind" ("xxx#categoryValueList") and "etag" ("SK9rTZDwMWQziLS1EaQOSfErSSg/BFr4zYLxnDCYuxn9Ger0L1DMlZo") fields.
The "items" fields are null ("kind", "name" and "value" are null).

I tried to generate a different xsd for the response but with always the same result.
There is no error returned in DataServices.

Have you any idea to solve my problem ?
Thanks in advance.
Back to top
eepjr24
Forum Enthusiast
Forum Enthusiast



Joined: 16 Sep 2005
ASUG Icon
Posts: 1814
Location: Orlando, FL


flag
PostPosted: Mon Jan 30, 2017 11:17 am 
Post subject: Re: Partial result from json response in ServiceWebREST API

Version of DS?
Have you tried dumping the result straight to an XML file with no un-nesting?

- E

_________________
Please Search before you post.
___________________________
Ernie Phelps
Senior Manager
Protiviti
http://www.protiviti.com
Back to top
vegaelce
Forum Member
Forum Member



Joined: 14 Feb 2009

Posts: 5



PostPosted: Tue Jan 31, 2017 3:44 am 
Post subject: Re: Partial result from json response in ServiceWebREST API

Hi,

Version of DS : 4.2 SP6

I tried an output directly in an XML file (with no un-nesting) but the result is the same :
the first ("kind") and the third ("etag") fields are OK but the "item" field is empty.
Back to top
eepjr24
Forum Enthusiast
Forum Enthusiast



Joined: 16 Sep 2005
ASUG Icon
Posts: 1814
Location: Orlando, FL


flag
PostPosted: Tue Jan 31, 2017 8:43 am 
Post subject: Re: Partial result from json response in ServiceWebREST API

Well, I don't see anything wrong with your JSON or the output in the trace. Maybe someone else has input? Otherwise I would open a ticket with SAP.

- E

_________________
Please Search before you post.
___________________________
Ernie Phelps
Senior Manager
Protiviti
http://www.protiviti.com
Back to top
ravisawa
Forum Member
Forum Member



Joined: 06 Oct 2017

Posts: 1



PostPosted: Fri Oct 06, 2017 5:05 pm 
Post subject: Re: Partial result from json response in ServiceWebREST API

I am facing similar issue. Did any one find a solution or work around for this?

Function call for the service returns output only for top level fields in the response. Any nested schema fields are sent out as null.

Below is the expected response format for function call
{
"requestId": "",
"result": [ {
"batchId": ,
"importId": "",
"status": ""
}],
"success": true
}

BODS is returning value only for requestid and success but not for nested columns.
When I set trace transform on I see the correct response in the trace log.

Also I have another API Call, it returns only a nested schema, there are no top level fields. Facing the same issue with it as well, in this case its coming all nulls. Below is expected response format.

{"token": {
"access_token": "",
"expires_in": ""
}}

Appreciate your help.
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> Data Integrator -> DI: Realtime and NRDM  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0158 seconds using 17 queries. (SQL 0.0031 Parse 0.0003 Other 0.0124)
CCBot/2.0 (http://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo