Soap Request Microsoft Translator on Android RRS feed

  • General discussion

  • Hey guys, 

    I am trying to use the Microsoft Translator with the SoapInterface on Android. 

    But it doesn't seem to work with the translate service. 

    i always get this response:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">ArgumentException: Invalid appId&#xD;
    Parameter name: appId : ID=0728.V2_Soap.Translate.38F4C8DF</faultstring></s:Fault></s:Body></s:Envelope>

    I have no idea what's wrong. 

    My Request looks like this:



     String authtoken=createAccessToken(clientId, clientSecret);

    request.addProperty("Authorization", authtoken); request.addProperty("text",textToTranslate); request.addProperty("from","de"); request.addProperty("to","en"); envelope.setOutputSoapObject(request); envelope.bodyOut = request; envelope.dotNet = true; envelope.encodingStyle="UTF-8"; transport.debug = true; transport.call(soapAction, envelope);



     public static String createAccessToken(String clientId, String  clientSecret){

          String result="Bearer "+"grant_type=client_credentials&client_id="+URLEncoder.encode(clientId)+"&client_secret="+URLEncoder.encode(clientSecret)+"&scope=http://api.microsofttranslator.com";
          return result;


    In my method createAccessToken, i try to create a token because appId is not valid anymore. Could someone help me?

    thx a lot 

    • Edited by android2011 Saturday, September 22, 2012 4:56 PM
    Saturday, September 22, 2012 4:51 PM

All replies

  • You are missing a step.

    Your createAccessToken should call the Azure service using the client id / client secret in order to get the access token.

    That value is then added to the 'Bearer'.

    I don't have a Java/Android sample handy, but if you check out:


    You'll see how this is done in C#, and it should be pretty trivial to move that over to Java.

    Monday, September 24, 2012 3:47 PM