Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:OBEX/Bluetooth - getReceivedHeaders() returns null (Known Issue)

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Nokia E61, Nokia E66, Nokia N91, Nokia N93, Nokia N95, Nokia 6110 Navigator
Created: schoenke (23 Dec 2008)
Last edited: hamishwillee (23 Jul 2013)


In S60 Editions prior to S60 3rd Edition FP2, calling getReceivedHeaders() after initiating an OBEX get operation returns null although the server side explicitly sends a header by calling the Operation.sendHeaders() method. This known issue has been verified by Nokia Developer.

How to reproduce

  1. Implement two MIDlets, a client and a server, for an OBEX test, by using the following code snippets:
    Client side:
    // [...]
    LocalDevice localDevice = LocalDevice.getLocalDevice();
    DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
    // Locate device
    // [...]
    // Search service
    // [...]
    // Connect to server
    conn = (ClientSession);
    HeaderSet reqHeader = conn.createHeaderSet();
    reqHeader.setHeader(HeaderSet.TYPE, "myType");
    Operation operation = conn.get(reqHeader);
    HeaderSet rspHeader = operation.getReceivedHeaders();
    if (rspHeader == null) {
    // show notification if the returned HeaderSet value is null
    // [...]
    Server side:
      // this method is part of a class that extends class ServerRequestHandler
    public int onGet(Operation pOperation) {
    try {
    HeaderSet reqHeader = pOperation.getReceivedHeaders();
    String type = (String) reqHeader.getHeader(HeaderSet.TYPE);
    ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
    // fill 'baos' depending on the content of 'type'
    HeaderSet rspHeader = createHeaderSet();
    rspHeader.setHeader(HeaderSet.LENGTH, new Long(target.size()));
    OutputStream os = pOperation.openOutputStream();
    return ResponseCodes.OBEX_HTTP_OK;
    catch (IOException e) {
    return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
  2. After installing test MIDlets, launch the server and the client.
  3. For the affected devices, the value that getReceivedHeaders() returns to the client will be null.


This issue has been fixed starting from S60 3rd Edition, FP2.

This page was last modified on 23 July 2013, at 07:37.
14 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.