Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Dynamic / Extensible web service client

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im looking for a way to develop web service client with following features
- When the web service (server) operation introduced new messages (i.e. new parameters/ remove parameters), I need to accommodate this change at run-time, with run-time configurations - without any change to my web-service client.

What I have in my mind with regards to UI changes I'm thinking of introducing server-side service - which will have some JSON configured with spring property listener. I will generate HTML out of JSON at my JS frontend. So when a new feild is introduced for SOAP request, I will change my JSON configuration which will add new for field in the UI.

This approach looks complex and appreciate if you could suggest a better approach.
 
Marshal
Posts: 3658
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One approach would be Smart-Server / Simple-Client, where the web service server server not only provides the information which the user would see, but to also provides metadata for the client application to use to display the information, validate user input, navigate/link to related information, etc.

The client could be built and deployed once -- any changes to the resources, their fields, how they should be presented to the user, navigation could be based on changes in the server-side only. The server could also tailor the information returned (resource data and metadata) based on the role of the users -- some users may have restricted views or capabilities compared to others.

Update: Something that I didn't mention -- the web service only provides resource data and metadata related to the resource fields, linking to other resources, and navigational hints (different from what you were suggesting). It does not provide anything related to UX presentation (such as html and css for a browser) nor behaviour (such as javascript and css, again for a browser). This would either be embedded in the client application, or provided by another service (such as a HTTP server serving-up static content)

Here is an example of a web server message flow which includes metadata:


The client application is at a view point (the URL for the view point would have been provided as a Link from an earlier response).
GET /api/profile/Factory/config/enb HTTP/1.1
Host: 169.254.1.1:8080
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Accept: */*
Referer: http://169.254.1.1:8080/api/profile/Factory/config
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,es;q=0.4,fr;q=0.2,ja;q=0.2


The clinet application shows the user that there are two navigation options -- Cell Information and S1 Interface (maybe using buttons).
HTTP/1.1 200 OK
Link: </api/profile/Factory/config/enb/cell-info>; rel="nav"; title="Cell Information"; use-method="GET"
Link: </api/profile/Factory/config/enb/s1-interface>; rel="nav"; title="S1 Interface"; use-method="GET"
Server: Platform Manager
Date: Thu, 01 Oct 2015 15:31:28 GMT
Content-Length: 0


The users selects S1 Interface, the client application follows the associated link.
GET /api/profile/Factory/config/enb/s1-interface HTTP/1.1
Host: 169.254.1.1:8080
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Accept: */*
Referer: http://169.254.1.1:8080/api/profile/Factory/config/enb
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,es;q=0.4,fr;q=0.2,ja;q=0.2


Server returns the resource data (for the eNodeB S1-Interface resource) as well as links for the additional data to be used by the client application for viewing and updating
HTTP/1.1 200 OK
Link: </api/metadata/view-for-update/enb-s1-interface>; rel="metadata"; use-method="GET"
Link: </api/profile/Factory/config/enb/s1-interface>; rel="update"; title="Update"; metadata="/api/metadata/update/enb-s1-interface"; use-method="PATCH"
Server: Platform Manager
Content-Type: application/json
Date: Thu, 01 Oct 2015 14:55:30 GMT
Content-Length: 50
{
   "mme-ip-address":"192.168.0.90",
   "mme-port":36412
}


The client application requests the metadata for viewing/updating. Since there is a link for update, the client application provides a means for the user to submit changes (maybe a button using the title in the link)
GET /api/metadata/view-for-update/enb-s1-interface HTTP/1.1
Host: 169.254.1.1:8080
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Accept: */*
Referer: http://169.254.1.1:8080/api/profile/Factory/config/enb/s1-interface
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,es;q=0.4,fr;q=0.2,ja;q=0.2


Response provides details on each field, including data on used to validate changes. The client application uses UI widgets appropriate for the type of data, makes the fields updatable or not based on if they are changeable
HTTP/1.1 200 OK
Server: Platform Manager
Content-Type: application/json
Date: Thu, 01 Oct 2015 14:55:30 GMT
Content-Length: 396
{
   "metadata":[
      {
         "name":"mme-ip-address",
         "changeable":true,
         "type":"text",
         "length":15,
         "regex":"(?:[0-9]{1,3}\\.){3}[0-9]{1,3}",
         "display-name":"MME IP Address",
         "description":"IP address used by the MME for the S1 interface"
      },
      {
         "name":"mme-port",
         "changeable":true,
         "type":"number",
         "min-value":1,
         "max-value":65535,
         "display-name":"MME Port",
         "description":"SCTP port used by the MME for the S1 interface"
      }
   ]
}


User makes a change, client application validates the data and submits the change.
PATCH /api/profile/Factory/config/enb/s1-interface HTTP/1.1
Host: 169.254.1.1:8080
Connection: keep-alive
Content-Length: 20
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Content-Type: application/json
Accept: */*
Referer: http://169.254.1.1:8080/api/profile/Factory/config/enb/s1-interface
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,es;q=0.4,fr;q=0.2,ja;q=0.2
{
   "mme-port":"36316"
}


Server responds and indicates change has been accepted (and will be applied). Server may also provide a link for the client application to navigate to next.
HTTP/1.1 202 Accepted
Server: Platform Manager
Date: Thu, 01 Oct 2015 15:09:43 GMT
Content-Length: 0
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic