[RESTWebServices] Not working

[RESTWebServices] Not working

Forge Component
Published on 2013-06-02 by Ricardo Silva
8 votes
Published on 2013-06-02 by Ricardo Silva
If you try to generate a WSDL from the following URL, it does not work.


Any ideas?
Hello Robert,

What JSON is it supposed to be processing?

When I tried accessing via my browser it returned me the following: {"error_description":"client id or secret is null","error":"invalid_client"}

This does not seem to be the intended result. Seems like it's an error message.

Is there anything else besides a GET that you need to do to get the intended result?

Best regards,
Ricardo Silva
I tried on the demo putting that URL and the Fetch returned "The remote server returned an error: (400) Bad Request."

This is the same thing that happens when using the browser. It seems like the request needs to be specially crafted, which the tool does not permit at the moment.

Can you link me to the documentation of that API so I understand what might need to be done here?

Is this it? https://developer.paypal.com/webapps/developer/docs/api/
Remember that this component's main focus is on transforming an example JSON into a WSDL to allow you to automatically generate the structures required for processing that JSON data.

The URL fetching is just an accelerator. If you have a JSON example, you can simply place it on the text box and hit the Download button and your WSDL will be generated for you.
Hi Ricardo, after download WSDL how can I generate my structures inside my app in OutSystems? Can you help me with this? And congratulations!
Hello Alexandre,

All you have to do to get the structures in your OutSystems application is to import the generated wsdl as a web service reference.

The general use case is covered in the documentation thread of this component.

Let me know (there) if you have any questions that aren't clear.
Hi Ricardo thanks for answer, I try to use with this link http://services.encomendaz.net/tracking.json?id=RB502264162CN but don't work the wsdl was generate put only 2 fields but you can see that exists more fields, I believe that your component look only first line of return. Can you see this? Thanks.
Hello Alexandre,

Indeed when there is a JSON array my component is assuming that all elements of the array have the same information, and so it looks only at the first element of an array.

In these weird cases you might want to help it out a bit and put the most general record first in the array.

I used the following json to "teach it" how to generate the correct WSDL for your service:

  "status": "ok",
  "data": [
      "date": "Mon, Jun 24 17:23:00 -0300 2013",
      "city": "Belo Horizonte",
      "state": "MG",
      "status": "delivered",
      "description": "Entrega Efetuada"
    }  ]
Hi All,

If we want to access this webservice (https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice), we should pass the required parameters appropriately.

This is the sample URL.
https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice?grant_type=authorization_code&client_id=[YOUR CLIENT ID]&client_secret=[YOUR CLIENT SECRET]&redirect_uri=[YOUR REDIRECT URI]&code=[YOUR AUTHORIZATION CODE (GET IT FROM AUTHORIZATION END POINT)]

I am trying with a different json and I get an object reference set error.

It's because the json consists of :

{"QueryResult": {"foo": "2", "bar": "0", "Errors": [], "Warnings": [], "TotalResultCount": 27, etc. etc. etc.

where he crashes on the [].

Can you fix that? :)

Oh, another thing, attributes starting with _ (underscore) are not filled in, even though the attributes are made (without the underscore)
Hello Statler,

The OutSystems language does not support having attributes starting with _. In this case I would suggest that you pre-process your JSON to remove this kind of attributes. It is in my backlog for ardoJSON to look into the matter of "weird characters in attribute names", but I don't know when I'll be able to tackle it.

Regarding the empty arrays, no I can't "fix" that. At that point you really need to give REST WebServices an example with at least one element in the array, otherwise it won't know what type to give the elements of the array. If you know you'll have simple strings there, just add them in the example.

I might add a better handler for this situation which makes the error more explicit, but I'll never be able to guess the type of the elements in an empty list :)

Best regards,
Ricardo Silva

I solved it by removing them.

still the feedback of errors could improve :)

I have some attributes that give errors like "cannot convert Object to string" but I have no clue which attribute of 30 it is :/