A message body writer for Java type, class myPackage.B, and MIME media type, application/octet-stream, was not found

In your client code you are not specifying the content type of the data you are sending – so Jersey is not able to locate the right MessageBodyWritter to serialize the b1 object. Modify the last line of your main method as follows: ClientResponse response = resource.type(MediaType.APPLICATION_XML).put(ClientResponse.class, b1); And add @XmlRootElement annotation to class B … Read more

How can I verify a Google authentication API access token?

For user check, just post get the access token as accessToken and post it and get the response https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=accessToken you can try in address bar in browsers too, use httppost and response in java also response will be like { “issued_to”: “xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com”, “audience”: “xxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com”, “user_id”: “xxxxxxxxxxxxxxxxxxxxxxx”, “scope”: “https://www.googleapis.com/auth/userinfo.profile https://gdata.youtube.com”, “expires_in”: 3340, “access_type”: “offline” } The … Read more

Why would one use REST instead of SOAP based services? [closed]

Less overhead (no SOAP envelope to wrap every call in) Less duplication (HTTP already represents operations like DELETE, PUT, GET, etc. that have to otherwise be represented in a SOAP envelope). More standardized – HTTP operations are well understood and operate consistently. Some SOAP implementations can get finicky. More human readable and testable (harder to … Read more

How to consume a web service from VB6?

I use this function to get data from a web service. Private Function HttpGetRequest(url As String) As DOMDocument Dim req As XMLHTTP60 Set req = New XMLHTTP60 req.Open “GET”, url, False req.send “” Dim resp As DOMDocument If req.responseText <> vbNullString Then Set resp = New DOMDocument60 resp.loadXML req.responseText Else Set resp = req.responseXML End … Read more

Patterns for handling batch operations in REST web services?

A simple RESTful pattern for batches is to make use of a collection resource. For example, to delete several messages at once. DELETE /mail?&id=0&id=1&id=2 It’s a little more complicated to batch update partial resources, or resource attributes. That is, update each markedAsRead attribute. Basically, instead of treating the attribute as part of each resource, you … Read more

Secure Web Services: REST over HTTPS vs SOAP + WS-Security. Which is better? [closed]

HTTPS secures the transmission of the message over the network and provides some assurance to the client about the identity of the server. This is what’s important to your bank or online stock broker. Their interest in authenticating the client is not in the identity of the computer, but in your identity. So card numbers, … Read more

JSON character encoding – is UTF-8 well-supported by browsers or should I use numeric escape sequences?

The JSON spec requires UTF-8 support by decoders. As a result, all JSON decoders can handle UTF-8 just as well as they can handle the numeric escape sequences. This is also the case for Javascript interpreters, which means JSONP will handle the UTF-8 encoded JSON as well. The ability for JSON encoders to use the … Read more

How do I upload a file with metadata using a REST web service?

I agree with Greg that a two phase approach is a reasonable solution, however I would do it the other way around. I would do: POST http://server/data/media body: { “Name”: “Test”, “Latitude”: 12.59817, “Longitude”: 52.12873 } To create the metadata entry and return a response like: 201 Created Location: http://server/data/media/21323 { “Name”: “Test”, “Latitude”: 12.59817, … Read more