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 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. |
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chatree Srichart updated OFBIZ-3877: ------------------------------------ Attachment: webservice.zip webservice.zip file container patch and additional jar file for web service > 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 > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12895564#action_12895564 ] Hans Bakker commented on OFBIZ-3877: ------------------------------------ i checked the patch, however it does not compile on the current trunk version > 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 > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896235#action_12896235 ] Hans Bakker commented on OFBIZ-3877: ------------------------------------ it looks like you have to issue the command TWO times in the hot-deploy/webservices directory: ../../ant reapply-ofbiz-patches Then it will compile fine. just talked to Chatree, thanks! > 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 > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896237#action_12896237 ] Hans Bakker commented on OFBIZ-3877: ------------------------------------ I just run the tests and everything looks ok now. If no major objections i will commit this the middle of next week. good job Chatree! Regards,' Hans > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hans Bakker reassigned OFBIZ-3877: ---------------------------------- Assignee: Hans Bakker > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896243#action_12896243 ] Scott Gray commented on OFBIZ-3877: ----------------------------------- These changes look interesting and at first (very quick) glance I'm not necessarily against them, BUT... these are fairly major changes to the service engine, one of the absolute core pieces of OFBiz. I beg you to not commit this until it has been reviewed by at least a few of committers. One question for starters: Is the enhanced service definition schema intended to also be used by OFBiz internally? For example, could I now define the contents of a Map typed attribute for a standard OFBiz service and have the incoming/outgoing context validated according to the definition? > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896250#action_12896250 ] Hans Bakker commented on OFBIZ-3877: ------------------------------------ Hi Scott, i completely agree with you (finally?) about the impact. The more technical questions will be answered by Chatree. If anybody has any more questions or concerns, please put them forward. Please also realize this is a major step towards using ofbiz as the basis of an enterprise service bus perhaps together with apache servicemix. We are at the moment servicing a rather big client which could be a chance to get to other big clients. so sure....lets be carefull with this commit.... any other opinions David? Regards, Hans > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896280#action_12896280 ] David E. Jones commented on OFBIZ-3877: --------------------------------------- I don't have any immediate opinions, not at the minute anyway, and I don't really have anything real to apply it to or try it on right now (nothing currently on the docket anyway). I'll see if I can shift some priorities and get a couple of my people on this soon, and hopefully you'll hear some feedback from them in the next little while. > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896480#action_12896480 ] Joonas Keturi commented on OFBIZ-3877: -------------------------------------- One question for starters: Is the enhanced service definition schema intended to also be used by OFBiz internally? For example, could I now define the contents of a Map typed attribute for a standard OFBiz service and have the incoming/outgoing context validated according to the definition? Answer: Yes it is possible to make almost any earlier service to operate through web service interface. You must complement services.xml with additional definitions so that there will be no left "free variables". Also success messages and error messages must be defined in services.xml. There are some restrictions though. You can't use structures which refer to themselves, like hierachical tree structure where same data type occurs in many levels. All nested attribute definitions must be specified directly under parent attribute, and can't be separate data types which could be referred from other attributes. > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896487#action_12896487 ] Scott Gray commented on OFBIZ-3877: ----------------------------------- Hi Joonas, Could you expand on "make almost any earlier service to operate through web service interface"? I don't know what web service interface means, I'm just talking about standard internal service execution using the LocalDispatcher. I get the feeling you are referring to service execution via the event handler introduced in the patch. > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896511#action_12896511 ] Joonas Keturi commented on OFBIZ-3877: -------------------------------------- Could you expand on "make almost any earlier service to operate through web service interface"? I don't know what web service interface means, I'm just talking about standard internal service execution using the LocalDispatcher. I get the feeling you are referring to service execution via the event handler introduced in the patch. I didn't get your earlier question right. I refer only to new web service event handler. New attribute definitions don't have effect on calling internally services with LocalDispatcher. These calls operate as before. No checking of nested attributes is done, although it's possible to modify code so that it could be done. Nested attributes are used for generating web service definition (WSDL and WADL) for web service clients, and checking web messages (SOAP and REST) when they come through new event handler. > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896709#action_12896709 ] Scott Gray commented on OFBIZ-3877: ----------------------------------- 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. > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896773#action_12896773 ] Joonas Keturi commented on OFBIZ-3877: -------------------------------------- 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. |
In reply to this post by Nicolas Malin (Jira)
[ 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896774#action_12896774 ] Joonas Keturi commented on OFBIZ-3877: -------------------------------------- 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chatree Srichart updated OFBIZ-3877: ------------------------------------ Description: 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.service.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/ There is another new important class org.ofbiz.service.webservice.engine.WebServiceClientEngine which corresponds to earlier org.ofbiz.service.engine.SOAPClientEngine but tries to support document style web services using SOAP with XML-format. Web services can be called using their WSDL-document or messages can be specified in services.xml without using WSDL-document. engine-attribute in services description is set to "webservice". Location of WSDL-document is given in attribute wsdlLocation or it can be left out if messages are described with attribute- definitions. Name of service in WSDL is given in attribute webServiceName and name of operation to be invoked in attribute invoke. One service-definition is needed for one web service-operation pair. Example of web service definitions are in file: framework/common/servicedef/services_test.xml This engine class uses other class: org.ofbiz.service.webservice.WebServiceClientModel which extends org.ofbiz.service.webservice.WebServiceModel and contains support for filling attribute definitions in org.ofbiz.service.ModelService from WSDL-document. 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>[?parameter=value...] REST web service with JSON-format is called with URL: /webtools/control/WebService/<service name here>?format=json[¶meter=value...] SOAP and REST web service requests are selected by request URL, where REST web service has appended service name in URL. 4.) Unit tests Tests for web services 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 Junit test suite definitions are in file framework/webapp/testdef/webservicetests.xml 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 Tests for web service client org.ofbiz.service.webservice.test.WebServiceClientTests This has 4 different tests which are: 1. Call SOAP-web service 2. Call SOAP-web service which needs authorization 3. Call SOAP-web service with wrong credentials 4. Call SOAP-web service without WSDL-document using service definitions Junit test suite definitions are in file framework/service/testdef/webserviceclienttests.xml These tests use same test services as tests for web services. Unit tests for web service client can be run with command: ant run-single-test-suite -Dtest.component=service -Dtest.suiteName=webserviceclienttests Created By: Joonas Keturi was: 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 Joonas Keturi ask me to update this issue. he said "I have fixed webservice patches so that service parameters are checked against service definitions nested attributes when calling services locally. I have also added web service client, which can call document style web services." > 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.service.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/ > There is another new important class > org.ofbiz.service.webservice.engine.WebServiceClientEngine > which corresponds to earlier > org.ofbiz.service.engine.SOAPClientEngine > but tries to support document style web services using > SOAP with XML-format. Web services can be called using > their WSDL-document or messages can be specified in > services.xml without using WSDL-document. engine-attribute > in services description is set to "webservice". Location > of WSDL-document is given in attribute wsdlLocation or > it can be left out if messages are described with attribute- > definitions. Name of service in WSDL is given in > attribute webServiceName and name of operation to be > invoked in attribute invoke. One service-definition is > needed for one web service-operation pair. > Example of web service definitions are in file: > framework/common/servicedef/services_test.xml > This engine class uses other class: > org.ofbiz.service.webservice.WebServiceClientModel > which extends org.ofbiz.service.webservice.WebServiceModel > and contains support for filling attribute definitions > in org.ofbiz.service.ModelService from WSDL-document. > 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>[?parameter=value...] > REST web service with JSON-format is called with URL: > /webtools/control/WebService/<service name here>?format=json[¶meter=value...] > SOAP and REST web service requests are selected by > request URL, where REST web service has appended > service name in URL. > 4.) Unit tests > Tests for web services > 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 > Junit test suite definitions are in file > framework/webapp/testdef/webservicetests.xml > 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 > Tests for web service client > org.ofbiz.service.webservice.test.WebServiceClientTests > This has 4 different tests which are: > 1. Call SOAP-web service > 2. Call SOAP-web service which needs authorization > 3. Call SOAP-web service with wrong credentials > 4. Call SOAP-web service without WSDL-document using service definitions > Junit test suite definitions are in file > framework/service/testdef/webserviceclienttests.xml > These tests use same test services as tests for web services. > Unit tests for web service client can be run with command: > ant run-single-test-suite -Dtest.component=service -Dtest.suiteName=webserviceclienttests > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chatree Srichart updated OFBIZ-3877: ------------------------------------ Attachment: webservice.zip New web service patch for service parameters are checked against service definitions nested attributes when calling services locally and added web service client, which can call document style web services. > 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, 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.service.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/ > There is another new important class > org.ofbiz.service.webservice.engine.WebServiceClientEngine > which corresponds to earlier > org.ofbiz.service.engine.SOAPClientEngine > but tries to support document style web services using > SOAP with XML-format. Web services can be called using > their WSDL-document or messages can be specified in > services.xml without using WSDL-document. engine-attribute > in services description is set to "webservice". Location > of WSDL-document is given in attribute wsdlLocation or > it can be left out if messages are described with attribute- > definitions. Name of service in WSDL is given in > attribute webServiceName and name of operation to be > invoked in attribute invoke. One service-definition is > needed for one web service-operation pair. > Example of web service definitions are in file: > framework/common/servicedef/services_test.xml > This engine class uses other class: > org.ofbiz.service.webservice.WebServiceClientModel > which extends org.ofbiz.service.webservice.WebServiceModel > and contains support for filling attribute definitions > in org.ofbiz.service.ModelService from WSDL-document. > 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>[?parameter=value...] > REST web service with JSON-format is called with URL: > /webtools/control/WebService/<service name here>?format=json[¶meter=value...] > SOAP and REST web service requests are selected by > request URL, where REST web service has appended > service name in URL. > 4.) Unit tests > Tests for web services > 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 > Junit test suite definitions are in file > framework/webapp/testdef/webservicetests.xml > 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 > Tests for web service client > org.ofbiz.service.webservice.test.WebServiceClientTests > This has 4 different tests which are: > 1. Call SOAP-web service > 2. Call SOAP-web service which needs authorization > 3. Call SOAP-web service with wrong credentials > 4. Call SOAP-web service without WSDL-document using service definitions > Junit test suite definitions are in file > framework/service/testdef/webserviceclienttests.xml > These tests use same test services as tests for web services. > Unit tests for web service client can be run with command: > ant run-single-test-suite -Dtest.component=service -Dtest.suiteName=webserviceclienttests > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chatree Srichart updated OFBIZ-3877: ------------------------------------ Attachment: (was: webservice.zip) > 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.service.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/ > There is another new important class > org.ofbiz.service.webservice.engine.WebServiceClientEngine > which corresponds to earlier > org.ofbiz.service.engine.SOAPClientEngine > but tries to support document style web services using > SOAP with XML-format. Web services can be called using > their WSDL-document or messages can be specified in > services.xml without using WSDL-document. engine-attribute > in services description is set to "webservice". Location > of WSDL-document is given in attribute wsdlLocation or > it can be left out if messages are described with attribute- > definitions. Name of service in WSDL is given in > attribute webServiceName and name of operation to be > invoked in attribute invoke. One service-definition is > needed for one web service-operation pair. > Example of web service definitions are in file: > framework/common/servicedef/services_test.xml > This engine class uses other class: > org.ofbiz.service.webservice.WebServiceClientModel > which extends org.ofbiz.service.webservice.WebServiceModel > and contains support for filling attribute definitions > in org.ofbiz.service.ModelService from WSDL-document. > 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>[?parameter=value...] > REST web service with JSON-format is called with URL: > /webtools/control/WebService/<service name here>?format=json[¶meter=value...] > SOAP and REST web service requests are selected by > request URL, where REST web service has appended > service name in URL. > 4.) Unit tests > Tests for web services > 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 > Junit test suite definitions are in file > framework/webapp/testdef/webservicetests.xml > 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 > Tests for web service client > org.ofbiz.service.webservice.test.WebServiceClientTests > This has 4 different tests which are: > 1. Call SOAP-web service > 2. Call SOAP-web service which needs authorization > 3. Call SOAP-web service with wrong credentials > 4. Call SOAP-web service without WSDL-document using service definitions > Junit test suite definitions are in file > framework/service/testdef/webserviceclienttests.xml > These tests use same test services as tests for web services. > Unit tests for web service client can be run with command: > ant run-single-test-suite -Dtest.component=service -Dtest.suiteName=webserviceclienttests > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-3877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900560#action_12900560 ] Hans Bakker commented on OFBIZ-3877: ------------------------------------ I checked the libraries which were added with this patch, they have either the Apache, CPL or Mozilla license which needs to be added to the license file. When the automated test will pass and now the comment from Scott has been resolved i see no reson why not commit this patch. Scott or any other committer or contributor please have a look at it. When no major problems i will commit on monday. Regards, Hans > 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.service.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/ > There is another new important class > org.ofbiz.service.webservice.engine.WebServiceClientEngine > which corresponds to earlier > org.ofbiz.service.engine.SOAPClientEngine > but tries to support document style web services using > SOAP with XML-format. Web services can be called using > their WSDL-document or messages can be specified in > services.xml without using WSDL-document. engine-attribute > in services description is set to "webservice". Location > of WSDL-document is given in attribute wsdlLocation or > it can be left out if messages are described with attribute- > definitions. Name of service in WSDL is given in > attribute webServiceName and name of operation to be > invoked in attribute invoke. One service-definition is > needed for one web service-operation pair. > Example of web service definitions are in file: > framework/common/servicedef/services_test.xml > This engine class uses other class: > org.ofbiz.service.webservice.WebServiceClientModel > which extends org.ofbiz.service.webservice.WebServiceModel > and contains support for filling attribute definitions > in org.ofbiz.service.ModelService from WSDL-document. > 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>[?parameter=value...] > REST web service with JSON-format is called with URL: > /webtools/control/WebService/<service name here>?format=json[¶meter=value...] > SOAP and REST web service requests are selected by > request URL, where REST web service has appended > service name in URL. > 4.) Unit tests > Tests for web services > 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 > Junit test suite definitions are in file > framework/webapp/testdef/webservicetests.xml > 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 > Tests for web service client > org.ofbiz.service.webservice.test.WebServiceClientTests > This has 4 different tests which are: > 1. Call SOAP-web service > 2. Call SOAP-web service which needs authorization > 3. Call SOAP-web service with wrong credentials > 4. Call SOAP-web service without WSDL-document using service definitions > Junit test suite definitions are in file > framework/service/testdef/webserviceclienttests.xml > These tests use same test services as tests for web services. > Unit tests for web service client can be run with command: > ant run-single-test-suite -Dtest.component=service -Dtest.suiteName=webserviceclienttests > 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. |
Free forum by Nabble | Edit this page |