Problem with URLEncode

When I am trying this:

var String message = Door_Lock_Event_En.state.toString
sendHttpGetRequest("http://192.168.192.61:5005/kok/say/" + URLEncoder::encode(message, 'UTF-8') +"/Joanna/50")

I receive this:

The name 'encode(<XFeatureCallImplCustom>,<XStringLiteralImpl>)' cannot be resolved to an item or type.

What is the problem?

/mike

Do you have

import java.net.URLEncoder

near the top of your .rules file?

1 Like

Thanks

I had missed that.

/mike

1 Like

Sorry

I am still receiving this error message.

2016-12-29 22:38:25.112 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Lock Changed': The name '<XIfExpressionImpl> || <XBinaryOperationImplCustom>' cannot be resolved to an item or type.

What i want to do is to URLEncode what I have in item Door_Lock_Event_En,
one example is “The SmartLock Huvudentre has been unlocked from the inside.”

Before I send it with sendHttpGetRequest.

/Mike

We would have to see the rule code that is the cause of this different log message.

With this I get it to work.

val urlmessage =  URLEncoder::encode(Door_Lock_Event_En.state.toString, 'UTF-8')
sendHttpGetRequest("http://192.168.192.61:5005/kok/say/" + urlmessage +"/Joanna/50")	

/Mike

1 Like