on 05-22-2015 11:57 AM
Dear All,
I have started integrate with Restful webserive (Scenario flow Resful--->PI-->Jdbc)
Restful webservice do not have any .wsdl (or) .xsd. this webservice only delivers JSON format.
so for ex JSON format is like this:
"Agency": "110",
"FlightDetails": {
"AirlineID": "LH",
"ConnID": "0400",
"Date": "2014-09-13"
},
Then how I create datatype in PI side? please suggest me on this.
Thanks & Regards,
Sateesh
Dear All,
My requirement PI uses GET operation( to fetch data) from Restful webservice.
REST gives JSON format.
example of my JSON format,
"PROJECTS": {
"project ID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
},
This is one record of data, it may be also multiple records in the same structure.
So how could be Data type structure on PI ESR? can you please suggest me on this
Note: My REST application user said they do not have any webservice (eiter .xsd (or) .wsdl file) for import to PI.
With Best Regards,
Sateesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sateesh,
You have to create structure below.
PROJECTS
ProjectID
PKZ
Date
since projects coming multiple times, you just keep occurrence as 0 to unbounded.
also you may get one problem when you get multiple records comes like below
"PROJECTS": [{
"project ID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
},
{
"project ID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
},
{
"project ID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
}]
you can observe when multiple records comes "[]" must be added at start and end respectively.
the problem is if you are using SAP REST adapter which came recently will not support ..that feature is available 7.4 sp12 which comes in next november.
also u can check below link.
Also if you still worry about creating the structure..you just follow below steps
1.since you are using get method, create an interface(dummy with out structure)and use restchannel(which contains correct url to get those records)
2.try to run that interface.then u will get records in xml
3.as per that xml, you can create structure.
Thanks & Regards,
Maheswarareddy
Hi Sateesh,
Firstly, before using the GET operation or any other operation, you must convert the JSON format to XML.
In order to do which, you first need to add a title / outer element to the structure, since there could be more than one root node in JSON structure, but there is always one root node in XML structure. You can do this in NWDS. Please refer the blog which I had previously given to you in this thread.
Secondly, if there are multiple structure, then also this should work, as there is already an outer element.
Regards,
Souvik
Hi Souvik,
i have done POC for PROXY to REST synchronous scenario for get method,
the scenario functionality is from ecc we have to send company code to rest server and that rest server should send back matching all records back to ecc.
when PI getting multiple records in json formate data from REST server, PI adapter would be convert to xml ..over here SAP standard REST adapter was not able to convert that json to xml because [ ] symbols when those comes multiple records like below.
{"PROJECTS": [{
"projectID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
},
{
"projectID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
},
{
"projectID": "LH",
"PKZ": "0400",
"Date": "2014-09-13"
}]
}
also let me explain json structure how its formed, i hope u know but still..
at beginning and end must be { } respectively which we can consider as root node.
when one node(here PROJECTS) repeats multiple times after "PROJECTS": should be " [ " and at end of records " ] "should be existed.
ultimatly what i am tring to say is when those [ ] comes in json data the current version of PI7.4 SP10 rest adapter not able to convert the msg JSON to xml.
how ever we can use code in modules level from below link
please make sure create structure like below
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:MT_test xmlns:ns0="http:Business.com">
<PROJECTS> (0 ...unbounded)
<projectID>LH</projectID>
<PKZ>0400</PKZ>
<Date>2014-09-13</Date>
</PROJECTS>
</ns0:MT_test>
and make sure configure in channel like below
Hello Maheshwar,
Thanks for let me know everything that you did on your POC.
Currently I am using REST sender Poll adapter to use GET operation. This feature is available on PI 7.31 SP16.
But currently my issue is on client Certificate Authenticate settings.
I have enabled the Client Certificate authentication In the REST Sender poll adapter because the client web service is expecting to login with certificate with basis authentication (HTTPS)
so that I have already imported the client certificate to PI NWA --> under Trusted CA's
In the settings part I have entered the parameter value of
Key store view is 'DEFAULT'
and Key store Entry is 'TRUSTED\TrustedCAs\certifcateName'
But I have seen the error is like "The requested key store type is not available in the default provider package or any of the other provider packages that were searched"
Please suggest me on this.
With Best Regards,
Sateesh
Hi Maheshwar,
I resolved by myself on this certificate issue.
I do not really require to fill the parameters under Certifcate base authentication while fetch the data(GET operation) from Rest webservice. So I disabled the option.
But please note , you need import their Certificate into our NWA.
Now another problem comes up.
My Target URL is look like this :https://tools-dev.ww7:9307/ceres/data/basic
But i need pass required parameter like 'lastChangedTime'
The value must be an ISO 8601 formatted time, containing the time zone, e.g. 2015-06-25T11:30:00Z
So final URL should be look like when PI contact the Rest Webservice
https://tools-dev.ww7:9307/ceres/data/basic?lastChangedTime=2015-06-25T11:30:00Z
Here the parameter value is not constant, it should be change dynamically.
So how to pass this dynamic parameter and value in the URL?
Thank you
Sateesh
HI Sateesh,
since your case sender is rest service, i am not sure how to send dynamically, if receiver is rest services we can do easily by udf in mapping and call that in channel or we can use xpath in channel,
>>>I have started integrate with Restful webserive (Scenario flow Resful--->PI-->Jdbc)
however i can suggest you create flows like below to do easy way,
1.ecc(proxy)<--->PI<-->Rest
2.ecc(proxy)-->PI-->JDBC
the first interface is ecc to rest synchronous(here you can send lastchangedTime filed data to pi and use that field as xpath in receiver channel(GET method) like below or you can use dynamic attribute also)
then receiver rest system will send back records ,those records need to be store in ecc table
and the second interface ECC to JDBC as asynchronous(here we need to send those table data to jdbc server.
i am not sure this is recommended
please refer this links also
Thanks,
Maheswarareddy
Hello Maheswar,
Ok, thank so much for your information.
I guess not suggestable option to convert into multiple interfaces.
As you know currently I am using sender REST adapter poll which is avilable on PI 7.31 SP16
Currently I am facing the issue on Dynamic part, i could n't able produce dynamic value.
My Target URL is look like this :https://tools-dev.ww007:9307/ceres/data/basic
But i need pass required parameter like 'lastChangedTime'
The value must be an ISO 8601 formatted time, containing the time zone, e.g. 2015-06-25T11:30:00Z
So final URL should be look like when PI contact the Webservice
https://tools-dev:9307/ceres/data/basic?lastChangedTime=2015-06-25T11:30:00Z
The value should be latest date time stamp.
How could I produce this value in the URL?
Thanks & Regards,
Sateesh
Hi Sateesh,
i am using 7.4 sp10(7.3SP15) , so i could not see polling option in my system to check.
your URI would be https://tools-dev:9307/ceres/data/basic?lastChangedTime={lastChangedTime}
and here the tricky is dynamically sending that lastChangedTime to sender channel itself, even this is very new to most of people ,
can you please contact to Alexander Bundschuh , who 's product owner of the this adapter ,whether its possible or not and please let us know what is the solution.
Thanks,
Maheswarareddy
Hi Sateesh,
In REST receiver channel of NWDS, under Adapter-Specific setting, under REST URL, please put the URL pattern as "https://tools-dev:9307/ceres/data/basic?lastChangedTime={ltime_par}".
After this in Value Source, please choose "Adapter Specific Attribute". Enter the "Patter Element Name" as ltime_par.
And in the third field please enter the variable in you PI message header in the same format as in PI message header.
Also in the REST operation tab,please enter the manual value as "Adapter Specific Attribute". Static Value should be "GET"
I think it should work then.
Regards,
Souvik
Hello Alexander,
Thanks for your nice blog.
I followed thid blog and i defined my URL looks below in the target URL
https://toolsdev:9307/ceres/data/basic?lastChangedTime=lastChangedTime&part=id&q=SAP&maxResults=10&order=date&publishedAfter={incrementalToken}
I am getting error like :illegal character in query at index 153, could you please help me what could be the wrong in my URL?
And my Incremental Request is
Hi Alexander,
Thanks for your hint, I thought it was standard. Sorry.
Actually this is my URL with required parameter
https://tools-dev:9307/ceres/data/basic?lastChangedTime=2015-04-08T10:00:00Z
If i use this URL with example of date time stamp and then PI get the data from Webservice.
If i use this URL with incrementalToken, as you have suggested in the blog then PI gets exception "Illegal character in query at index 83"
https://tools-dev:9307/ceres/data/basic?lastChangedTime={incrementalToken}
Both cases i used timestamp format(yyyy-MM-dd'T'HH:mm:ss'Z') in the IncrementalRequest tab.
Can you please suggest about this error "Illegal character in query at index 83".
Thanks & Regards,
Sateesh
Hello Alex,
Our SP16 REST adapter features is supporting to convert from JSON to XML with Multiple data sets?
I heard from some threads those SP14 & SP15 are not supporting multiple datasets when converting from JSON to XML
if this is also same case on SP16 , then how can I proceed to accepts multiple Datasets.
Please suggest me on this.
Thanks & Regards,
Sateesh N
Hello All,
I have achieved on my requirement with the help from Mr. Maheswar and Alex.
Maheswar helped me on the ESR objects side and Alex blog helped on the connection settings.
But my actual problem was generate dynamic value on REST url. after updated latest patch level of SAP XIAF, then dynamic value works.
Thank you.
Sateesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sateesh,
You can convert the JSON format for XML (by help of any online tool) and then generate the schema from XML.
refer the below link to convert into XML.
Free Online JSON to XML Converter - FreeFormatter.com
regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.