none
wns send push RRS feed

  • 질문

  • Hi.

    Using the java rest api tries to send WNS push .

    Header value sent is as follows:

    [Authorization: Bearer <access_token>
    , Content-Type: text/xml
    , ServiceBusNotification-Format: windows
    , X-WNS-Type: wns/toast
    , Content-Length: 380
    , User-Agent: Jakarta Commons-HttpClient/3.1
    , Host: ollehtvmobile.servicebus.windows.net
    ]

    access_token was generated in https://login.live.com/accesstoken.srf

    But I get the following error sends a push.

    <Error><Code>401</Code>
    <Detail>MalformedToken: The credentials contained in the authorization header are not in the WRAP format..TrackingId:5369b47b-c4cd-48d0-89e6-3cb441547551_G1,TimeStamp:3/7/2016 7:58:16 AM
    </Detail></Error>

    Why is this? I can't find any documentation explaining the reason.

    please help me ...

    See the source

    -----------------

    JSONParser parser = new JSONParser();
     
    JSONObject obj = (JSONObject)parser.parse(returnValue.toString());
     
     
    String TokenString = (String)obj.get("access_token");               

    String xmlString ="<?xml version='1.0' encoding='utf-8'?><toast><visual><binding template='ToastText01'><text id='1'>test text</text></binding></visual></toast>";

       /
       getMethod.setRequestHeader("Authorization", "Bearer " + TokenString);
       getMethod.setRequestHeader("Content-Type", "text/xml");
       getMethod.setRequestHeader("ServiceBusNotification-Format", "windows");
       getMethod.setRequestHeader("X-WNS-Type", "wns/toast");    
       getMethod.setRequestHeader("Content-Length", Tokenleng);  


       RequestEntity entity = new StringRequestEntity(xmlString, "text/xml", null);

       getMethod.setRequestEntity(entity);
       //getMethod.setRequestBody(xmlString);


       int statusCode1 =  client.executeMethod(getMethod);

    -------------------------------------------------------------------------------------------------



    • 편집됨 otm noti 2016년 3월 7일 월요일 오전 8:50
    2016년 3월 7일 월요일 오전 8:27

답변