you are right, if its a 1 dimensional body you will need only 1 integral

but you also have to find out the relation of r with l.

hint:

if you draw a xy coordinate axis (parallel and perpendicular to the infinite wire), you can do it

then

and you got a 1d integral