Will using WSDL to generate REST clients the wrong way?

I am going to create a fairly simple web service for use internally. Ultimately, the service will become an interface to the database, which will allow me to track what various internal tools inside the company are doing. I think I need a web service so that various tools (and therefore different languages) within the organization can easily update the database without the need to know the schema.

I read many related REST and SOAP questions that come up from the https://stackoverflow.com/search?q=soap+rest search , but I'm not sure I found my answer.

My dilemma seems to be that I want REST simplicity as well as the ability to generate WSDL code, which seems to imply SOAP. It is very important for me that various internal tools (JAVA, Perl, Python, PHP, C ++) can talk with this service, and it would be foolish to manually rewrite / maintain the interface level for each of these languages ​​when the WSDL route does this for me. From what I can say, if WS needs to be changed, you should update the WSDL, restore the client stubs and make any changes necessary for the code that uses the stubs (which had to be done anyway).

For example, let's say I have a tool written in JAVA that uses a RESTful web service. I believe that this tool will have special code to work with specific URLs, launch a request, execute something with a response, translate it into some kind of data structure if I want, etc. Now let's say that I also have a Perl tool that does the same thing. Now I need Perl code to do the same, make requests at specific URLs, get answers, do something with them, etc. In each case, and therefore in C ++ and Python and C #, where the code cannot be shared, you will end up with classes / shell methods that hide a lot of this ugliness from me. I would rather call a class function that returns my data encapsulated in an object, instead of worrying about the URL,arguments, answer, etc. Of course, perhaps this is not a lot of code in any particular place, it begins to take shape over time. Multiply this by each of the tools, and now, when I make changes to the service, I have to update the URLs in each CRUD operation and everything connected with it. I think I assume that with WSDL this is the aspect that is made for you. Your code just interacts with stubs. What stubs do, who cares? URLs, arguments, answers - if something changes, just restore the stubs from the WSDL. If this process causes your code to break, let it be, but at least I also do not need to update all the code that is related to the specifics of the request and working with the response. Is this really not a problem? Perhaps I just need to create a service and several clients and seewhat am i really against.

JAVA, Perl, Python, ++ .., , WS WS, . WSDL/SOAP , , , REST ?

+3
5

.

REST . HTTP- JSON ( XML).

HTTP- (, Apache Commons Python urrlib2). JSON ( XML). (, JAXB-JSON).

""? RESTful Java Python REST HTTP.

class OurService {
    def getAResource( String argValue ) {
        path = { "fixed", argValue };
        URI uri= build_path( path );
        return connection.get( uri )

[ .]

/ SOAP?


", JAVA, - RESTful"... " Perl "... " ++ Python #".

.

", "

. . . "" WSDL - (1) (2) . REST. , .

Python

class Some_REST_Stub( object ):
    def get_some_resource( self, arg ): # This name is from the WSDL
        uri = "http://host:port/path/to/resource/%s/" % arg # This path is from the WSDL
        data= urllib2.open( uri )
        return json.load( data )

WSDL, . , , - , URI - .

. REST Java. , . , JSON, . .

RESTful WSDL XML.

  • " " URI.

  • GET, PUT, POST DELETE, Stub.

, . , REST HttpRequest HttpResponse. . , . - .

WSDL, JSONObject XML URLEncoded .

" , , , , URL-, , .."

, "". , WSDL, .

" , , , URL- CRUD , ".

. WSDL, . , , URI .

", , WSDL , ".

, "". WSDL ? , . , WSDL , . , , , . WSDL.

" ".

.

" , ? URL-, , - - , WSDL".

, . WSDL - , . URI - . - JSONObjects. - HttpResponses, JSONArray. .

" , ".

, . HTTP , . GET, POST, PUT DELETE .

+5

Fossill,

SOAP . Ws- * , () , , .

(Java, Perl, Python, ++), REST (, , HTTP). : .

., . .

, Yahoo: http://tech.groups.yahoo.com/group/rest-discuss/ REST.

- , WS - *.

Jan

+1

, , , .

WSDL REST, . WS/SOAP ( ) , , .

"" -. ( , ), . , , , REST. ( ) WS-* .

+1

FYI-REST WSDL, WADL. .

+1

Apache CXF Java REST, " ", , SOAP.

+1

Source: https://habr.com/ru/post/1733973/


All Articles