Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [om2m-dev] notification to another server (network application)

Hello Liu,

The platform is sending correctly notifications to your server-enabled application which is listening on http://193.253.35.17:8080.
The "400 Bad Request" error comes from your "Apache-Coyote" specific server which is not able to handle the POST request sent to him by the platform.
I advice you to check your server implementation using the "simple rest client" chrome plugin (or another one). You can send directly HTTP POST request with a "notify" representation body to http://193.253.35.17:8080/demo_sc2gp/main/Main/ and just display the payload in your console.

Mahdi
 

Le 26/06/2014 11:52, LIU Feifei a écrit :

Hello,

 

Here is the log :

 

 

INFO: ResourceController [ContentInstanceController]
Jun 26, 2014 9:38:36 AM org.eclipse.om2m.core.notifier.Notifier$1 run
INFO: Notification Request:

RequestIndication [method=CREATE, base=null, targetID=null, representation=<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<om2m:notify xmlns:om2m="
http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
    <om2m:statusCode>STATUS_CREATED</om2m:statusCode>
    <om2m:representation xmime:contentType="application/xml">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8b20ybTpjb250ZW50SW5zdGFuY2UgeG1sbnM6b20ybT0iaHR0cDovL3VyaS5ldHNpLm9yZy9tMm0iIHhtbG5zOnhtaW1lPSJodHRwOi8vd3d3LnczLm9yZy8yMDA1LzA1L3htbG1pbWUiIG9tMm06aWQ9IkNJXzg5MzA2NTk1MCIgaHJlZj0ibnNjbC9hcHBsaWNhdGlvbnMvTGFtcEFwcC9jb250YWluZXJzL0xhbXBBcHBUb1NjYXBlL2NvbnRlbnRJbnN0YW5jZXMvQ0lfODkzMDY1OTUwIj4KICAgIDxvbTJtOmNyZWF0aW9uVGltZT4yMDE0LTA2LTI2VDA5OjM4OjM2Ljk2N1o8L29tMm06Y3JlYXRpb25UaW1lPgogICAgPG9tMm06bGFzdE1vZGlmaWVkVGltZT4yMDE0LTA2LTI2VDA5OjM4OjM2Ljk2N1o8L29tMm06bGFzdE1vZGlmaWVkVGltZT4KICAgIDxvbTJtOmRlbGF5VG9sZXJhbmNlPjIwMTQtMDYtMjZUMTI6NTg6MzYuOTY3Wjwvb20ybTpkZWxheVRvbGVyYW5jZT4KICAgIDxvbTJtOmNvbnRlbnRTaXplPjQ5PC9vbTJtOmNvbnRlbnRTaXplPgogICAgPG9tMm06Y29udGVudD5QSEp2YjNRZ1ptbHNaUzEyWlhKemFXOXVQU0l4TGpZaVBqeHZjbVJsY2o1UFRqd3ZiM0prWlhJK1BDOXliMjkwUGc9PTwvb20ybTpjb250ZW50Pgo8L29tMm06Y29udGVudEluc3RhbmNlPgo=</om2m:representation>
    <om2m:subscriptionReference>nscl/applications/LampApp/containers/LampAppToScape/contentInstances/subscriptions/SUB_87266580</om2m:subscriptionReference>
</om2m:notify>
, requestingEntity=admin/admin, protocol=null]

 

 

Here the base URL is set to the “contact” of the subscription:


Jun 26, 2014 9:38:36 AM org.eclipse.om2m.core.comm.RestClient sendRequest
INFO: RequestIndication [method=CREATE, base=
http://193.253.35.17:8080/demo_sc2gp/main/Main/, targetID=, representation=<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<om2m:notify xmlns:om2m="
http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
    <om2m:statusCode>STATUS_CREATED</om2m:statusCode>
    <om2m:representation xmime:contentType="application/xml">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8b20ybTpjb250ZW50SW5zdGFuY2UgeG1sbnM6b20ybT0iaHR0cDovL3VyaS5ldHNpLm9yZy9tMm0iIHhtbG5zOnhtaW1lPSJodHRwOi8vd3d3LnczLm9yZy8yMDA1LzA1L3htbG1pbWUiIG9tMm06aWQ9IkNJXzg5MzA2NTk1MCIgaHJlZj0ibnNjbC9hcHBsaWNhdGlvbnMvTGFtcEFwcC9jb250YWluZXJzL0xhbXBBcHBUb1NjYXBlL2NvbnRlbnRJbnN0YW5jZXMvQ0lfODkzMDY1OTUwIj4KICAgIDxvbTJtOmNyZWF0aW9uVGltZT4yMDE0LTA2LTI2VDA5OjM4OjM2Ljk2N1o8L29tMm06Y3JlYXRpb25UaW1lPgogICAgPG9tMm06bGFzdE1vZGlmaWVkVGltZT4yMDE0LTA2LTI2VDA5OjM4OjM2Ljk2N1o8L29tMm06bGFzdE1vZGlmaWVkVGltZT4KICAgIDxvbTJtOmRlbGF5VG9sZXJhbmNlPjIwMTQtMDYtMjZUMTI6NTg6MzYuOTY3Wjwvb20ybTpkZWxheVRvbGVyYW5jZT4KICAgIDxvbTJtOmNvbnRlbnRTaXplPjQ5PC9vbTJtOmNvbnRlbnRTaXplPgogICAgPG9tMm06Y29udGVudD5QSEp2YjNRZ1ptbHNaUzEyWlhKemFXOXVQU0l4TGpZaVBqeHZjbVJsY2o1UFRqd3ZiM0prWlhJK1BDOXliMjkwUGc9PTwvb20ybTpjb250ZW50Pgo8L29tMm06Y29udGVudEluc3RhbmNlPgo=</om2m:representation>
    <om2m:subscriptionReference>nscl/applications/LampApp/containers/LampAppToScape/contentInstances/subscriptions/SUB_87266580</om2m:subscriptionReference>
</om2m:notify>
, requestingEntity=admin/admin, protocol=null]


Jun 26, 2014 9:38:37 AM org.apache.commons.httpclient.HttpMethodBase getResponseBody
WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
Jun 26, 2014 9:38:37 AM org.eclipse.om2m.core.comm.RestClient sendRequest
INFO: ResponseConfirm [statusCode=STATUS_BAD_REQUEST, representation=, resourceURI=null]
Jun 26, 2014 9:38:37 AM org.eclipse.om2m.core.notifier.Notifier$1 run
INFO: Notification Response:
ResponseConfirm [statusCode=STATUS_BAD_REQUEST, representation=, resourceURI=null]

 

 

Best Regards,

Feifei LIU

 

 

De : om2m-dev-bounces@xxxxxxxxxxx [mailto:om2m-dev-bounces@xxxxxxxxxxx] De la part de Mahdi Ben Alaya
Envoyé : mercredi 25 juin 2014 17:59
À : OM2M Developer discussions
Objet : Re: [om2m-dev] notification to another server (network application)

 

Hello,

Could you show me the subscription representation and the log ?
Thanks,

Mahdi

Le 25/06/2014 17:52, LIU Feifei a écrit :

Hello,

 

As Mr. Ben Alaya explained to me the class of notification :

 

public static ResponseConfirm notify(RequestIndication requestIndication, String contact){
        // Check whether the subscription contact is protocol-dependent or not.
        if(contact.matches(".*://.*")){
            // Contact = protocol-dependent -> direct notification using the rest client.
            requestIndication.setBase(contact);
            requestIndication.setTargetID("");
            return new RestClient().sendRequest(requestIndication);
        }else{
            // Contact = protocol-independent -> Check whether the targeted SCL is local or remote.
            String sclId = contact.split("/")[0];
            requestIndication.setTargetID(contact);
            if(Constants.SCL_ID.equals(sclId)){
                // scl = local -> perform request on the local scl.
                return new Router().doRequest(requestIndication);
            }else{
                // scl = remote -> retarget request to the remote scl.
               
return new Redirector().retarget(requestIndication);
            }
        }
    }



 

We tried our project with the first scenario :         if(contact.matches(".*://.*")).

 

A network application runs on a server and it is subscribed in another network application of the NSCL.

 

The returned notification request is good until the class RestHttpClient in the package “org.eclipse.om2m.comm.http”  processes the request. It returns a status code “400” with the result “ bad-request”.

 

We have met the right notification address as the contact but we can’t get the right result. Could you help me to resolve this problem?

 

 

Best Regards,

LIU Feifei

#
" Ce courriel et les documents qui lui sont joints peuvent contenir des
informations confidentielles ou ayant un caractè privéS'ils ne vous sont
pas destiné nous vous signalons qu'il est strictement interdit de les
divulguer, de les reproduire ou d'en utiliser de quelque maniè que ce
soit le contenu. Si ce message vous a é transmis par erreur, merci d'en
informer l'expéteur et de supprimer imméatement de votre systè
informatique ce courriel ainsi que tous les documents qui y sont attaché"
 
 
                               ******
 
" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are
notified that any dissemination, copying of this e-mail and any attachments
thereto or use of their contents by any means whatsoever is strictly
prohibited. If you have received this e-mail in error, please advise the
sender immediately and delete this e-mail and all attached documents
from your computer system."
#




_______________________________________________
om2m-dev mailing list
om2m-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/om2m-dev

 

#
" Ce courriel et les documents qui lui sont joints peuvent contenir des
informations confidentielles ou ayant un caractè privéS'ils ne vous sont
pas destiné nous vous signalons qu'il est strictement interdit de les
divulguer, de les reproduire ou d'en utiliser de quelque maniè que ce
soit le contenu. Si ce message vous a é transmis par erreur, merci d'en
informer l'expéteur et de supprimer imméatement de votre systè
informatique ce courriel ainsi que tous les documents qui y sont attaché"


                               ******

" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are
notified that any dissemination, copying of this e-mail and any attachments
thereto or use of their contents by any means whatsoever is strictly
prohibited. If you have received this e-mail in error, please advise the
sender immediately and delete this e-mail and all attached documents
from your computer system."
#


_______________________________________________
om2m-dev mailing list
om2m-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/om2m-dev


Back to the top