hennroja / immowebAPI

Java API for immoweb.be
14 stars 1 forks source link

Incapsula Incident - immoweb API #1

Open OKahraman opened 8 years ago

OKahraman commented 8 years ago

Hi Henn -

Looks like Java API can't get the response from immoweb? Do you have the same error message once you try with demochecker?

Here are the details.

http://www.immoweb.be/en/mobile.cfc?method=getResults&xVenteLocation=2&xIdCategorie=5&clientSource=&iphone=&xPrice1=399&xPrice2=700&xCodeCommune1=1000&xCodeCommune2=1040&xCodeCommune3=1050&xmeuble=Y

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: ; line: 1, column: 2]

at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1581)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:533)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:462)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1624)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:689)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3776)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3721)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2726)
at de.hennroja.immoweb.api.ImmowebApi.search(ImmowebApi.java:64)
at DemoChecker.main(DemoChecker.java:19)

Exception in thread "main" java.lang.NullPointerException at DemoChecker.main(DemoChecker.java:32)

w0mby commented 8 years ago

You should change the cookie in the ImmowebAPI file. So go to immoweb with any browser and take your ResponseCookie (at least it's the used term in chrome) and put it in place of the current one (here: connection.addRequestProperty("Cookie","") ) I don't yet think about automatic solution here but at least taking it once is enough after for multiple calls.