[ 
https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joonas Keturi updated OFBIZ-3877:
---------------------------------

    Comment: was deleted

(was: I would suggest that we either:

    * define a separate schema specifically for web services that serves as an 
extension to a standard service definition, i.e. you define a normal service 
and then in a separate file you extend its definition with the information 
required for it to function as a web service
    * or we add support to the service engine to support the additional schema 
information

Obviously I prefer the latter, I think it would be a big win to be able to more 
clearly define ambiguous service attributes such as Maps. I'm really not very 
comfortable with adding elements and attributes to the service definition 
schema if those new pieces aren't actually supported by the service engine 
itself.

Hopefully within the next couple of days I'll be able to take a closer look at 
the schema definition changes and provide some feedback on them, I've only 
really taken a glance so far.
[ Show ยป ]
Scott Gray added a comment - 09/Aug/10 05:58 PM Thanks Joonas, it does concern 
me a little though. Altering the standard service definition schema in a major 
way but then only supporting those changes via a single event handler seems 
likely to cause a lot of confusion for developers who aren't using web 
services. I would suggest that we either:

    * define a separate schema specifically for web services that serves as an 
extension to a standard service definition, i.e. you define a normal service 
and then in a separate file you extend its definition with the information 
required for it to function as a web service
    * or we add support to the service engine to support the additional schema 
information

Obviously I prefer the latter, I think it would be a big win to be able to more 
clearly define ambiguous service attributes such as Maps. I'm really not very 
comfortable with adding elements and attributes to the service definition 
schema if those new pieces aren't actually supported by the service engine 
itself. Hopefully within the next couple of days I'll be able to take a closer 
look at the schema definition changes and provide some feedback on them, I've 
only really taken a glance so far.


Second alternative looks better for me also. If you want, I can make changes to 
code so that parameters of local service invocations are checked also against 
nested attribute definitions. This will only have effect on validation of 
parameters, no new functionality will be introduced.
)

> New Web Service Style
> ---------------------
>
>                 Key: OFBIZ-3877
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3877
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>         Environment: Windows, Ubuntu Linux
>            Reporter: Chatree Srichart
>            Assignee: Hans Bakker
>         Attachments: webservice.zip
>
>
> This is a new stub for new web service style that use a normal style (not 
> hash map [key/value]).
> [[ Installation ]]
> - Extract webservice.zip file (attached file) to hot-deploy directory of 
> OFBiz framework
> - run ant task for apply patch in webservice directory with:
>    ant reapply-ofbiz-patches 
> [[ Features ]]
> 1.) New classes
>  
> There is new important class
>  
> org.ofbiz.webapp.webservice.event.WebServiceEventHandler
>  
> which corresponds to earlier
>  
> org.ofbiz.webapp.event.SOAPEventHandler
>  
> but tries to support document style web services using
> SOAP with XML-format, or REST with XML and JSON-formats.
> This handler class uses other class:
>  
> org.ofbiz.webapp.webservice.WebServiceModel
>  
> which wraps inside class
>  
> org.ofbiz.service.ModelService
>  
> and contains support for WSDL-generation, WADL-generation
> and conversion between Java Maps and XML-object models.
> WSDL=Web Service Definition Language for SOAP-interface
> http://www.w3.org/TR/wsdl
> WADL=Web Application Description Language for REST-interface
> http://www.w3.org/Submission/wadl/
>  
> 2.) Service definitions
>  
> Web service interface can be used only if service definition
> file services.xml is completed with additional definitions.
> Schema of this file is extended.
>  
> attribute-elements can have nested attribute elements
> which describe structure of Java maps and lists.
> If attribute has type Map, it should have nested attributes
> which describe contents of this map.
> If attribute has type List, it should have nested attributes
> which describe element contents of this list.
> If List has simple elements, there must be only one
> nested attribute, which describes element.
> If List has element which is map or other list, there
> must be one nested attribute stating that the element
> is Map or List, and then this attribute should have
> nested attributes describing structure of Map or
> structure of list element.
> There are also two new modes for attributes
> ERROR which means that attribute is responded as error message
> OUTERROR which means that attribute is responded as error
>  or as success message
> These modes are needed for web services to describe
> which parameters will go to detail-elements of SOAP Fault response
> or REST error messages. Also in WSDL- and WADL-files will be
> generated XML-schema for general response messages.
>  
> File framework\webapp\servicedef\services_test.xml
> can be used as example of attribute definitions.
> This file is used in unit tests of web service interface.
>  
> 3.) Web service requests
>  
> In REST-services HTTP GET-method is used in services whose
> name start with words "find" or "get". These services should
> have input parameters in one level, so that they can be
> given as query parameters in URL. HTTP DELETE-method is used
> with services whose name start with word "remove". Other services
> are used with HTTP POST-method and PUT-method. Service must
> look itself for method name POST or PUT, if it is required
> to operate differently in insert or update cases.
>  
> List of links to all WSDL-documents can be requested with URL:
>  
> /webtools/control/WebService?wsdl
>  
> Specific WSDL-document is requested with URL:
>  
> /webtools/control/WebService/<service name here>?wsdl
>  
> SOAP web service is called with URL:
>  
> /webtools/control/WebService
>  
> Notice that no service name is added to URL. Operation
> name in request message specifies the service name.
>  
> List of links to all WADL-documents can be requested with URL:
>  
> /webtools/control/WebService?wadl
>  
> Specific WADL-document is requested with URL:
>  
> /webtools/control/WebService/<service name here>?wadl
>  
> REST web service is called with URL:
>  
> /webtools/control/WebService/<service name here>
>  
> SOAP and REST web service requests are selected by
> request URL, where REST web service has appended
> service name in URL.
>  
> 4.) Unit tests
>  
> org.ofbiz.webapp.webservice.test.WebServiceTests
>  
> This has 14 different tests which are:
> 1. Conversion of XML-object model to Map
> 2. Conversion of Map to XML-object model
> 3. Call SOAP-web service
> 4. Call SOAP-web service which needs authorization
> 5. Call SOAP-web service with wrong credentials
> 6. Call SOAP-web service with wrong service name
> 7. Call REST-web service
> 8. Call REST-web service which needs authorization
> 9. Call REST-web service with wrong credentials
> 10. Call REST-web service with wrong service name
> 11. Call REST-web service using JSON-format
> 12. Call REST-web service which needs authorization using JSON-format
> 13. Call REST-web service with wrong credentials using JSON-format
> 14. Call REST-web service with wrong service name using JSON-format
>  
> These unit tests use test service in class
> org.ofbiz.webapp.webservice.test.WebServiceTestServices
> Service definitions are in file
> framework\webapp\servicedef\services_test.xml
>  
> Unit tests for web service interface can be run with command:
>  
> ant run-single-test-suite -Dtest.component=webapp 
> -Dtest.suiteName=webservicetests
> Created By: Joonas Keturi

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to