anchor.diff:          Error ->            error(Error)
       end.
   
  +parse_validate_resp(Resp) ->
  +    case catch xmerl_scan:string(Resp) of
  +        {#xmlElement{name=validationResult,
  +                     content = [#xmlElement{name='ValidationResultType',
  +                                            content = [#xmlText{value = "OK"}]}]}, _} -> ok;
  +        {#xmlElement{name=validationResult,
  +                     content = [#xmlElement{name='ValidationResultType',
  +                                            content = [#xmlText{value = Other}]}]}, _} -> Other;
  +        Other ->
  +            ?Error("Parse ~p error ~p", [Resp, Other]),
  +            Other
  +    end.
  
positive.code: -define(HTTP_PROFILE(__AppId), ?GET_CONFIG(smsTokenValidationHttpProfile, [__AppId], smsott)).
  -define(HTTP_OPTS(__AppId), ?GET_CONFIG(smsTokenValidationHttpOpts, [__AppId], [])).
  
  -define(HTTP_SOAP_PROFILE(__AppId), ?GET_CONFIG(smsTokenValidationHttpSoapProfile, [__AppId], soapsmsott)).
  -define(HTTP_SOAP_OPTS(__AppId), ?GET_CONFIG(smsTokenValidationHttpSoapOpts, [__AppId], [])).
  
  -export([ send_sms_token/3
          , sc_soap_send_sms_token/2
          , verify_sms_token/4
          ]).
  
  -spec send_sms_token(atom(), binary(), ddCredRequest()) ->
      ok | no_return().
  send_sms_token(AppId, To, {smsott,Map}) when Map == #{} ->
      sc_send_sms_token(AppId, To);
  send_sms_token(_AppId, _To, _DDCredRequest) ->
      error("Unimplemented").
  
  -spec verify_sms_token(atom(), binary(), list() | integer() | binary(), ddCredRequest()) ->
      ok | no_return().
  verify_sms_token(AppId, To, Token, {smsott,Map}) when Map == #{} ->
      sc_verify_sms_token(AppId, To, Token);
  verify_sms_token(_AppId, _To, _Token, _DDCredRequest) ->
      error("Unimplemented").
  
  % @doc
  sc_soap_send_sms_token(AppId,To) ->
      sc_send_sms_token( ?GET_CONFIG(smsTokenValidationSoapServiceUrl,[AppId],"https://host:port/sendSoapSmsToken")
                       , ?GET_CONFIG(smsTokenSoapServiceParsms,[AppId],{"user","password","xmlns"})
                       , ?GET_CONFIG(smsTokenSoapServiceFromMSISDN,[AppId],"+41790000000")
                       , To
                       , ?GET_CONFIG(smsTokenValidationText, [AppId], <<"Imem verification code: %TOKEN% \r\nThis token will expire in 2 Minutes.">>)
                       , ?GET_CONFIG(smsTokenValidationTokenType,[AppId],<<"SHORT_NUMERIC">>)
                       , ?GET_CONFIG(smsTokenValidationExpireTime,[AppId],180)
                       , ?GET_CONFIG(smsTokenValidationTTL,[AppId],180)
                       , ?GET_CONFIG(smsTokenValidationTokenLength,[AppId],6)
                       , imem_client:get_profile(httpc, ?HTTP_SOAP_PROFILE(AppId), ?HTTP_SOAP_OPTS(AppId))
                       ).
  
  sc_send_sms_token(AppId,To) ->
      sc_send_sms_token( AppId
  
negative.code:                        , imem_client:get_profile(httpc, ?HTTP_PROFILE(AppId), ?HTTP_OPTS(AppId))
                         ).
  
  sc_verify_sms_token(Url, {User, Password, XMLNs}, To, Token, Profile) ->
      Req = list_to_binary([
              "<validateSmsToken xmlns=\"",XMLNs,"\">"
                  "<msisdn>",To,"</msisdn>"
                  "<validationToken>",Token,"</validationToken>"
              "</validateSmsToken>"]),
      Authorization = "Basic "++binary_to_list(base64:encode(User++":"++Password)),
      ?Debug("Validate sms token ~p from ~p", [Req, Url]),
      case httpc:request(post, {Url,
                                [{"Authorization",Authorization},
                                 {"Accept","application/xml;charset=utf-8"}],
                             "application/xml;charset=UTF-8", Req},
                         [{ssl,[{verify,0}]}], [{full_result, false}],
                         Profile) of
          {ok,{200,Body}} ->
              case parse_validate_resp(Body) of
                  ok -> ok;
                  Error -> error({"SOAP", Error})
              end;
          {ok,{Other,Body}} ->    error({"HTTP", Other, Body});
          {error, Error} ->       error(Error);
          Error ->                error(Error)
      end;
  sc_verify_sms_token(Url, ClientId, To, Token, Profile) ->
      case httpc:request( get
                        , { string:join([Url,To,Token],"/")
  