Archive for the 'WebServices' Category


Basic REST web service example ..

May 08, 2015 in Java, REST, Web, WebServices



@Controller // –> Declare a Spring MVC Controller

@RequestMapping(“/computer”) // –> Map an URI with a controller or a method

@PathVariable // –> Read a variable in an Uri and assign this value to a java variable

@RequestBody // –> Declare a Pojo class to map the http request body

@ResponseBody // –> Declare a Pojo class to generate Json content to return to the http client

// Declaration as this class as a controller

// Declaration that this controller handles requests on uri */computer

public class ComputerController {

// Stores computers
private static final ComputerStorage computerStorage = new ComputerStorage();

// Declare a method that handle all GET request on */computer
@RequestMapping(method = RequestMethod.GET)

// Return a list of computer to the http client
@ResponseBody public List getComputers() {
return computerStorage.getAll();


Geolocation webservices notes

Oct 11, 2011 in Geolocation, WebServices

Zip code to geolocation service (zip to geolocation, postal code to geolocation)

Bing geolocation query example


Or using a python script to exercise and experiment :

import os

# python

BKEY = 'BlahBlahMyBingKeyBluhBluh.'

def makeurl1():
    burl = ''
    burl += '?CountryRegion=US'
    burl += '\&adminDistrict=WA'
    burl += '\&locality=Somewhere'
    burl += '\&postalCode=98001'
    burl += '\&addressLine=100%20Main%20St.'
    burl += '\&key=' + BKEY

    return burl;

def makeurl2():
    burl = ''
    burl += '?CountryRegion=US'
    burl += '\&locality=San%20Francisco'
    burl += '\&postalCode=94121'
    burl += '\&addressLine=529%2029th%20Ave.'
    burl += '\&key=' + BKEY

    return burl;

burl = makeurl2()

print 'URL: ' + burl

sts = os.system("wget -O qbing1.json " + burl )

Yahoo (webservices) query language

Notes on “Java Web Services” ..

Jul 02, 2009 in Books, Java, Software, WebServices

This book is a bit old.. 2002..

  • — SOA – Service Oriented Architecture
    — 3 major roles: Provider, Registry (Broker) and Requester.
    — SOA is based on web services.
  • — SOAP – Simple Object Access Protocol
    — 2 major methods: Message-based Document Exchange AND RPC
    (Remote Procedure Calls).
    — All structures based on XML.
    — A SOAP message contains an Envelope and a Header.
    — A SOAP message may contain (MIME) attachments.
    — Main transport protocol is HTTP(S).
    — Providers (Receivers) are usually based on Servlets.
  • — SOAP-RPC
    — Method signatures contain a single SOAP structure.
    — SOAP service methods must match info in deployment descriptor.
    — Errors and Faults: VersionMismatch, MustUnderstand, DTDNotSupported, etc..
  • — WSDL – Web Services Description Language
    — WSDL is an XML grammar for describing a web service
    as a collection of access end-points capable of exchanging
    messages in a procedure- or document-oriented fashion (p. 72)
    — The reasonable flow is to create service methods and
    than generate WSDL from code using tools.
    — Best practices: web service is (functionally) coarse-grained
    and messages are more business-oriented than programmatic.
  • — UDDI – Universal Description, Discovery and Integration
    — Similar to an Internet search engine for businesses.
    — UBR – UDDI Business Registry (the Public Cloud).
    — Designed for B2B mostly.
    — 2 APIs: inquiry and publishing API.
    — JAXR = Java API for XML Registries.
    — Some details: Categorization (NAICS, ISO, etc..),
    Identifier (DUNS, Thomas Reg, etc),
    tModel (web service metadata)
  • — JAX-RPC and JAXM
    — JAXM = Java API for XML Messaging.
    — JAX-RPC = Java API for XML-based RPC.
    — JAXM may be used as a frontend to SOAP-based messaging
    frameworks through the use of “profiles”.
    — JAX-RPC covers code generation for client and server parts,
    dynamic SOAP, creating services within J2EE and J2SE environments,
    bindings, serialization, mapping of datatypes between WSDL and Java,
  • — The Java Web Service (JWS) Standard
    — Proposed by BEA, using templates to create simple web services.
    — Example (HelloWorld.jws <- note the .jws extension)
    Note the annotations @operation, @conversation ..

    import com.bea.jws.*
    public class HelloWorld extends Service {
      * @operation
      * @conversation stateless
      public String getHelloWorld() {
        return "Hello, World!";

    Other values for @conversation are ‘start’, ‘continue’ or
    ‘finish’. The ‘start’ directive, for example, starts a session.

  • — Security notes
    — Use of SSL (HTTPS), encryption, signing and secure hashing.
    — Security Assertion Markup Language (SAML) – used with Single Sign-On (SSO).
  • — Resources

Colophon – European (Alpine) Ibex – a wild goat.