Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Integrate Amazon Marketplace Web Service in Genro  (Read 14113 times)
Stefan S.
Posts: 90


« on: April 11, 2017, 11:41:00 am »

Hello,

for a new Project we have to integrate Amazon Services into our Genero-Application.
In the first step we want to upload Product-Information (XML-Files)

There is a lot of Documentation in the Web....
It seems not to be possible to use WSDL-Webservices.
Insted of WSDL there is the "Amazon MWS"

https://developer.amazonservices.de/gp/mws/api.html?ie=UTF8&group=bde&section=feeds&version=latest

There is a java Client-Libary. Is it possible to use this in Genero?
Has anyone integrated Amazon-Services in Genero?

Any help is welcome......

Thanks in advance

Stefan Serwe









Christian G.
Four Js
Posts: 3


« Reply #1 on: April 11, 2017, 06:09:20 pm »

Hello Stefan,

Amazon Web Services are not SOAP web services but REST web services that share a XML file. So no WSDL files here.
While You can Import the Java class provided by Amazon in your program, You can directly use the com.HTTPRequest methods delivered with Genero.
The examples in the documentation http://4js.com/online_documentation/fjs-fgl-manual-html/?path=fjs-fgl-manual#c_gws_ComHTTPRequest_methods.html or the example posted on FourjsGenero GitHub, https://github.com/FourjsGenero/gws_rest_upload_multipart might help you in your first steps with com.HTTPRequest methods.

Christian
Reuben B.
Four Js
Posts: 1116


« Reply #2 on: April 12, 2017, 04:28:32 am »

I'll point out that in the Genero 3.10 EAP which is currently running there are two new RESTful Web Service demos/examples as well.

The key with most RESTful Web Services is understanding the API, and from that determining what 4gl methods are appropriate.  So if I take for an example a page like http://docs.developer.amazonservices.com/en_US/feeds/Feeds_SubmitFeed.html you will see some switches that allow you to Show/Hide example code, use these as a guide.  Also look to see if there is a test area/sandbox you can test on.

If you have not done any RESTful Web Services I would suggest working closely with your local support centre to get the first API done.  Once you have done one, the second, third will be easier.

Reuben


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Stefan S.
Posts: 90


« Reply #3 on: April 12, 2017, 10:10:51 am »

ok, thanks for.
I think that I try to use the Java-Libary first....

@Reuben: you are right.... the First time it is always the most difficult
Frank G.
Four Js
Posts: 48


« Reply #4 on: April 12, 2017, 10:19:08 am »

Hello,
 
 As Amazon WS is not SOAP, there is no WSDL, but I saw that for each service, they provide a XML schema files. So you should be able to use fglwsdl -x command to generate the 4GL variables according to such XML schema, and then via xml.serializer.domtovariable() to deserialize the xml response in the 4GL variable.

Something like following :

$ fglwsdl -x g-ecx.images-amazon.com/images/G/01/mwsportal/doc/en_US/products/ProductsAPI_Response.xsd -o ProductsAPI.inc

GLOBALS "ProductsAPI.inc"

MAIN
  DEFINE req com.HTTPRequest
  DEFINE resp com.HTTPResponse
  DEFINE doc xml.DomDocument
  LET req = com.HTTPRequest(url + query parameters)
  LET resp = req.getResponse()
  LET doc = resp.getXmlResponse()
  CALL xml.Serializer.DomToVariable(doc.getDocumentElement, ProductsAPI.Product)
END MAIN

Frank
Stefan S.
Posts: 90


« Reply #5 on: April 13, 2017, 08:26:03 am »

Hello Frank,

that looks interesting.
But when I try to get the 4GL Variables from the XSD I only receive an error:

fglwsdl  -x http://g-ecx.images-amazon.com/images/G/01/mwsportal/doc/en_US/products/ProductsAPI_Response.xsd
WARNING: URL at http://g-ecx.images-amazon.com/images/G/01/mwsportal/doc/en_US/products/ProductsAPI_Response.xsd is not xml
ERROR : Cannot instantiate abstract element 'AttributeSet'.

Frank G.
Four Js
Posts: 48


« Reply #6 on: April 13, 2017, 09:48:14 am »

Hello Stephen,

Yes I reproduced the issue. It is already reported as issue GWS-34. I will fix it for 3.10. As workaround you simply have to remove ' abstract="true" ' from the XML element named 'AttributeSet' at line 51. Of course, you need first to download the .xsd on your disk and call fglwsdl -x on that file.


Regards,
Frank
Stefan S.
Posts: 90


« Reply #7 on: April 13, 2017, 11:50:03 am »

Hello Frank,

thanks. It working.
Now I can have a look how to build the correct "Amazon"-Url.


Stefan
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines